The Programmer's Longevity Guide: Living Longer as a Math Problem

Source: the open-source project HowToLiveLonger (geekan/HowToLiveLonger) — every number below comes with an academic citation in the original. Translated and adapted by this site.

Illustration of the three pillars of longevity: healthy diet, exercise, and restful sleep

Sitting all day, all-nighters, takeout, bubble tea — the programmer's standard four debuffs.

Someone turned "how to live longer" into a math problem. There is exactly one objective function: all-cause mortality (ACM). Every recommendation is tagged with "cuts ACM by X%", and every number links to a paper.

Three caveats before the numbers seduce you:

Below: the parts most relevant to programmers.

Key takeaways

What is the one objective function of longevity?

All-cause mortality (ACM). This guide treats living longer as a math problem: every recommendation is tagged with how much it cuts ACM, and every number links to an academic paper. Percentages don't add up — risk factors interact — but they rank the levers honestly. Source: geekan/HowToLiveLonger, translated and adapted by this site.

Which lever matters most: diet, exercise, or sleep?

Exercise, by the mortality math. 150–300 minutes of brisk walking a week is linked to about 30% lower all-cause mortality; 7,800 daily steps to roughly 45% less than 3,500 steps. Diet and sleep still matter — five daily servings of fruits and vegetables run about 13% lower mortality than two — but movement is the king of value.

How much sleep do I actually need?

About 7 hours a night, ideally starting between 22:00 and midnight. Both short and long sleep are linked to higher mortality — the curve is U-shaped, not ‘more is better.’ Consistency beats weekend catch-up: a regular bedtime stabilizes the circadian rhythm that governs blood pressure, glucose, and immune function.

1. Eat: the input side

Staples

The power trio

Drinks

Smoking

2. Move: the output side — king of value

3. Sleep: 7 hours, between 22:00 and midnight

4. A few counterintuitive ones

If you only do three things: play badminton 3× a week, walk 7,000 steps a day, swap bubble tea for tea. Everything else is bonus.

5. Honest disclosure

The original author listed four methodological warnings; reproduced verbatim:

This is not medical advice — it's "evidence worth knowing." Before changing your diet or taking anything mentioned in the original list (e.g. metformin, spermidine), talk to a doctor.