Posted by: Dave Richeson | August 26, 2009

More on twin primes and Pythagorean triples


In that post I pointed out that:

  1. 8675309 is a prime.

Pat asked:

What is the smallest number that would meet all three conditions above, that is it is a twin prime and it is also the hypotenuse of a primitive Pythagorean triple…. Ok, way to easy … what is the NEXT smallest?

Well, after some failed attempts to get WolframAlpha to answer the question for me, I decided to go at it the old fashioned (i.e., pre-2009) way. Google the terms, get lists of twin primes and primitive Pythagorean triples, and start checking by hand.

What I found was that there are many twin primes that are also hypotenuses of Pythagorean triples. In fact, all of the first 35 twin prime pairs had one twin which was such a hypotenuse. For example:

(3,5) ~ (3,4,5)
(5,7) ~ (3,4,5)
(11,13) ~ (5,12,13)
(17,19) ~ (8,15,17)
(29,31) ~ (20,21,29)
(41,43) ~ (9,40,41)
(59, 61) ~ (11,60,61)
(71,73) ~ (48,55,73)
(101, 103) ~ (20,99,101)
(107, 109) ~ (60,91,109)
(137, 139) ~ (88,105,137)
(149, 151) ~ (51,140,149)
~ skip some pairs ~
(881, 883) ~ (369,800,881)

I am not a number theorist, so I don’t know if this has any significance or not. I do know that if the hypotenuse in a Pythagorean triple is prime, then it must have the form 4n+1. So that explains why we don’t see both twins of a twin prime pair in a Pythagorean triple.

So let me ask my own question: what is the smallest twin prime pair (p,q) such that neither p nor q is the hypotenuse of a Pythagorean triple?



  1. All primes of the form 4n+1 can br expressed as a sum of 2 squares. This result goes back to Fermat. (That’s the fellow whose famous conjecture was proved a few years back.)

    I looked up a proof of the 4n+1 prime theorem.
    But, it’s just a little too long to include here.

  2. I am not sure that is possible. In any pair of twin primes, one of them must be congruent to 1 mod 4, and any prime congruent to one mod 4 can be written as the sum of two squares, r^2 + s^2, say, (I think you can use Gaussian integers to prove this) which means that the numbers r^2+s^2, 2rs and r^2-s^2 (assuming that r>s) form a Pythagorean triple, with r^2+s^2 the hypotenuse.

  3. Very nice! Thank you both for putting that to rest! Number theory never ceases to amaze me.

  4. […] read this follow-up post.] Possibly related posts: (automatically generated)Google Voice will let you change your phone […]

  5. […] Dave Richeson writes about the prime , twin primes and Pythagorean triples. […]

  6. IS there such a thing as a twin primes in which neither prime is a Pythagorean hypotenuse? If the smaller of the pair is 4k+1, the larger is 4k+3. If the smaller is 4k+3, then the larger is 4k+5 or 4k+4+1 or 4(k+1)+1 or 4v+1. Since any prime 4v+1 is a Pythagorean hypotenuse, one twin prime is always a Pythagorean hypotenuse. Do you agree? Or have I overlooked something?

  7. […] fun (from here and here) is that it (8675309) is also a twin prime (it’s prime and so is 8675311). Since […]

  8. If you take a primitive Pythagorean triple and add each side’s square to the distance from the closest number between two twin primes, that equation will also be true, and divide evenly by at least six.

    For example, 21^2+20^2=29^2. For 21^2, the next twin primes are 461 and 463 (20 and 22 away) so add 21. Do the same for the other sides and you get (21^2+21)+(20^2+20)=(29^2+41), or 462+420=882.


%d bloggers like this: