# The number of prime years in a lifetime

$2013$ is not a prime: $3 \times 11 \times 61$. I was born in a prime year, and if I live as expected according to the statistics for U.S. males, I will just reach another prime year, $2027$. That will encompass $11$ prime years in my lifetime, which I assume is high (because birth and probable-expiration hit primes directly).

What is the expected number of prime years in a lifetime of length $x$ years, starting at year $n$? I am aware that the Second Hardy-Littlewood Conjecture is likely to be false for large $n$, but does that conjectured relationship, $\pi(x+y) \le \pi(x) + \pi(y)$, still yield the best interval estimate for small $n$?

-
In addition to the very nice answer from Eric N, change the first occurrence of i in the WA Routine to "current_age + i", where a is your current age and it will provide your age versus year versus if it is a prime year for the next 200 years. For example, it is currently set to age 15 years old. Live long and prosper! Regards – Amzoti Jan 1 '13 at 2:02
are you going to live to 2027 but skip 2017? – Jonathan Jan 1 '13 at 4:31
@Jonathan: No, I was counting 2017: ..., 2011, 2017, 2027. – Joseph O'Rourke Jan 1 '13 at 13:07

What is the expected number of prime years in a lifetime of length $x$ years, starting at year $n$?

The exact number will be $\pi(n+x)-\pi(n)$, where $\pi(y)=\sum_{p\leq y}1$ is the prime counting function, but how large do we expect this to be?

The primes are distributed around $n$ with density $\frac{1}{\log n}$, so the expected number would be between $\frac{x}{\log n}$ and $\frac{x}{\log (n+x)}$. Provided that $n$ is much larger than $x$, this gives $\frac{x}{\log n}$ as the expected number of prime years. Supposing that a man born in $2000$ lives to the ripe old age of $100$, this estimate gives approximately $13$ primes in their lifetime. In reality there are $14$ primes between $2000$ and $2100$, which is not far off.

Note however, that if we take $n$ to be very large, it is possible that a person may live to $100$ and never experience a prime year. Indeed, suppose that an individual was born in the year $K=101!+1$. Then even if they live a long life, and die at $100$ years old, they will never have experienced a prime year, since each of $101!+2$, $101!+3$, $101!+4$,...,$101!+101$ are composite.

In the opposite direction, the Brun-Titchmarsh theorem tells us that $$\pi(x+n)-\pi(n)\leq \frac{2x}{\log x},$$ which gives us an upper bound on the number of prime years one can experience. Even if one were to live to be $200$ years old, they would not see more than $75$ primes, regardless of when they were born.

Added: The density of the primes, which is $\frac{1}{\log n}$ around $n$, goes to zero as $n\rightarrow\infty$, so unless life expectancy increases over time, the expected number of primes experienced in the average lifetime will converge to zero. A person born around the year $1$ million A.D. would expect to see only 7 primes if she were to live to $100$. To achieve the same expected number of primes as a woman born near the year $2000$, she would have to live to $190$.

This can also be used to give a good idea of how slowly $\log x$ grows. For an individual's expected number of primes to be less than $1$ in their lifetime, they would have to be born past the year $10^{44}$ A.D., and considering that best estimates put the death of the sun at around $4\times 10^9$ A.D., this is very far away.

In fact, for the next $368000$ years, every individual who lives to be $100$ will experience at least one prime year. However, there is no prime over a $114$ year period from $370261$ A.D. to $370365$ A.D., so for the unfortunate individual born in $370261$ A.D., they will experience no prime years unless they live past 114 years old.

-
Aside from this being a comprehensive answer, it's nice that in the end you included the opposite question (and answer) as well. – user54147 Jan 1 '13 at 2:06
This answer is worth well more than the question---Thanks, Eric! And may you see many primes. :-) – Joseph O'Rourke Jan 1 '13 at 2:14
If you are born in the year $101!$, then "if they live a long life" might not equal "$100$ years old". A complete answer should also take into account the increase in life expectancy over the years :) – TMM Jan 1 '13 at 2:32
You upper bound estimate of $75$ primes seems to be a very conservative estimate. Can we obtain a better estimate using the sieve method for the number of primes one would see over a period of $200$ ? i.e. going upto the prime $13$ can we say that within $200$ consecutive number approximately $$200 (1-1/2)(1-1/3)(1-1/5)(1-1/7)(1-/11)(1-/13) \approx 38$$ are likely to be prime? – user17762 Jan 1 '13 at 2:46
The year $100! + 1$ will likely be long after the heat death of the universe, so I don't think Bob will be too worried about not having any prime-years during his life :) – BlueRaja - Danny Pflughoeft Jan 1 '13 at 8:43