My age in years will be prime and so will that of my friend who's age differs by 12 years.

I'd like to know if we both live to be 1000, roughly how often would this happen?

I understand that I can get a table of primes up to 1000 or calculate them by factoring and know exactly, but does mathematics offer any way to make a probabilistic prediction for the frequency of primes that differ by 12 up to 1000?

  • 3
    $\begingroup$ Very loose upper bound is $30\%$, since the least positive residue of your age, $\pmod{10}$ must be an element in $\{1,7,9\}.$ Clearly, you could tighten this up via a $\pmod{30}$ argument, but what would be the point? $\endgroup$ Feb 14 at 6:36
  • 1
    $\begingroup$ It is well-known that there are 168 primes below 1000. We can drop $2,3$ from that list for obvious reasons, but otherwise take the 166 remaining primes $p \lt 1000$ and apply @user2661923's percentage to $p+12$ to get a quick approximation. [NB: Primes can also end in the digit 3.] $\endgroup$
    – hardmath
    Feb 14 at 15:33
  • 1
    $\begingroup$ The true percentage of (posutuve) primes $p$ below $1000$ such that $p+12 \lt 1000$ is prime is actually about $41.6\%$. See OEIS A046133. This is pretty close to estimating by the last digit of the larger prime being $1,3,7,9$. $\endgroup$
    – hardmath
    Feb 14 at 17:43
  • 1
    $\begingroup$ @hardmath given a pair of primes, that differ by $(12)$ years, the smallest of the two primes can not be congruent to $(3) \pmod{10}.$ The issue is not the frequency of primes but rather the frequency of satisfying prime pairs. $\endgroup$ Feb 14 at 19:24
  • 2
    $\begingroup$ For so short intervals, estimations are usually not very good. Just apply brute force. Estimations do make sense in much larger ranges. $\endgroup$
    – Peter
    Feb 14 at 20:46

1 Answer 1


The usual way of estimating the count of primes $p$ below $1000$, combined with @user2661923's idea of just sieving the last digit of the second prime $p+12$, gives a fairly realistic estimate.

What is the usual way? It is the Prime Number Theorem or related estimates. Gauss's logarithmic integral is particularly accurate in its approximation of the prime counting function $\pi(x)$, but $x/\ln(x)$ is not too far off. The latter gives $145$ and the former $178$, with the actual number in between.

Since $p+12$ will have to end in $1,3,7$ or $9$, we take $40\%$ of any of those figures. The simple estimate would then be $0.4 × 145 = 58$. The actual number of prime pairs differing by $12$ below $1000$ is $69$.

While pairs of primes differing by six are called "sexy", there doesn't seem to be an analogous term for prime differing by twelve. However sexy prime triplets do provide some cases of pairs differing by twelve.

  • $\begingroup$ Minor quibble: $p + 12$ can not end in $7$. $\endgroup$ Feb 15 at 6:15
  • $\begingroup$ @user2661923: True, other than the initial case, (5,17). I'd certainly welcome and upvote a more careful analysis. $\endgroup$
    – hardmath
    Feb 15 at 17:23
  • $\begingroup$ @user2661923 I'd read (and upvoted) your Comment before posting. What I have in mind a "careful analysis" would be to relate the probability of $p$ being prime to $p+12$ being prime. These probabilities are not independent because divisors $2,3$ having been excluded for $p$, they are automatically excluded for $p+12$. It has the effect of making $p+12$ more likely to be prime. $\endgroup$
    – hardmath
    Feb 15 at 20:02
  • $\begingroup$ Oh, okay. There are two problems here: [1] My knowledge of Number Theory is fairly rudimentary. I have skimmed other peoples analysis re prime number frequency, but I am not qualified to do this. I would have to study the Number Theory subtopic for some time, before attempting this. ...see next comment $\endgroup$ Feb 15 at 22:36
  • $\begingroup$ [2] Conceptually, which prime numbers between $2$ and $31$ are to be considered? Certainly, if only the prime numbers $~2,3,~$ and $~5~$ are to be considered, then you could simply examine the numbers in $\{31,32,\cdots,60\}$ (for example, for the smaller prime), and how ever many satisfying pairs you find, that will be the expected percentage, for every $30$ numbers. This would certainly be a tighter upper bound than my original $30\%$ estimate. However, again, what is the point? This is just brute force with a sieve. Do you have a more generic analytical idea? $\endgroup$ Feb 15 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.