Pythagorean triples are sets of three integers (a,b,c) where a2 + b2 = c2. The simplest of these (other than 0,0,0) is (3,4,5) as 9 + 16 = 25. There are clearly an unlimited number of these triples as any multiple of (3,4,5), say (33,44,55), is also a member of the set (1089 + 1936 = 3025).
Ignoring these multiples, how many of these triples are there?
![]() |
The image on the left is constructed by taking the first two terms (a
and b) an plotting them on squared paper. In this chart the 'c' value is
now the distance of the points from the origin.
Light blue points represent those values of a and b that have no common factors. There are basically five of these - (3,4), (5,12), (7,24), (8,15) and (20, 21) - with c values of (5,13,25,17 and 29). The 8 fold symmetry and the other 35 light blue points arise because if a2 + b2 = c2 is true for (a,b) it is also true for (b,a), (-b,a), (-a,-b) etc. The darker blue points represent the multiples of the basic points, (6,8), (9,12), (10,24) etc. |
I will call the triples where a and b have no common factors, a < b , with a and b > 0 the prime triples. So how many prime triples are there? The next image shows all the triples (prime or otherwise) out to (320,320).

The prime ones are shown in light blue and their multiples darker. Each prime triple generates a line of evenly spaces multiples which are shown in darker blue. The really obvious lines are generated by variations of (3,4). There are 57 prime triples in this diagram:
| (3, 4, 5) | (8, 15, 17) | (60, 221, 229) | (65, 72, 97) | (175, 288, 337) |
| (5, 12, 13) | (12, 35, 37) | (68, 285, 293) | (85, 132, 157) | (140, 171, 221) |
| (7, 24, 25) | (16, 63, 65) | (33, 56, 65) | (95, 168, 193) | (160, 231, 281) |
| (9, 40, 41) | (20, 99, 101) | (39, 80, 89) | (105, 208, 233) | (180, 299, 349) |
| (11, 60, 61) | (24, 143, 145) | (51, 140, 149) | (115, 252, 277) | (204, 253, 325) |
| (13, 84, 85) | (28, 195, 197) | (57, 176, 185) | (88, 105, 137) | (207, 224, 305) |
| (15, 112, 113) | (32, 255, 257) | (69, 260, 269) | (104, 153, 185) | (225, 272, 353) |
| (17, 144, 145) | (20, 21, 29) | (75, 308, 317) | (120, 209, 241) | (252, 275, 373) |
| (19, 180, 181) | (28, 45, 53) | (48, 55, 73) | (136, 273, 305) | (297, 304, 425) |
| (21, 220, 221) | (36, 77, 85) | (60, 91, 109) | (119, 120, 169) | |
| (23, 264, 265) | (44, 117, 125) | (84, 187, 205) | (133, 156, 205) | |
| (25, 312, 313) | (52, 165, 173) | (96, 247, 265) | (161, 240, 289) |
The simplest way to generate a sequence of triples is to notice that difference between consecutive square numbers generates the sequence of odd numbers [3,5,7,9,...]. If the odd number is also a square [9,25,49,...] you have a triple. And because two consecutive square numbers can't have any common factors we have a mechanism for generating an unlimited number of prime triples. The numbers in the first column of the previous table belong to this sequence.
The associated Python program Pythagoras.py implements a more sophisticated algorithm. Basically it finds integer solutions (a,b) of the equation a2 + b2 = (b+n)2 for a given value of 'n'.
So (n(2k+1), n(2k2+2k), n(2k2+2k+1)) will be a Pythagorean triple. We can cancel the n's out giving the series (2k+1, 2k2+2k, 2k2+2k+1) which is actually the series we've already identified by subtracting consecutive squares.
Although the above algorithm generates an unlimited sequence of tripples it doesn't generate them all. From our original 5 triples, (8, 15, 17) and (20, 21, 29) don't appear. The others all belong to the sets generated by special cases of 'n',
This generates the series (2m(k+1), 2k2+2k+(1-n)/2, 2k2+2k+(1+n)/2). For n = 1 this gives the series (2k+1, 2k2+2k, 2k2+2k+1) which is the series we've already derived. For larger values of n (9,25,49,81,...) we get additional series...
| n = 9 | (27, 36, 45) | (33, 56, 65) | (39, 80, 89) | (45, 108, 117) | etc... |
| 25 | (65, 72, 97) | (75, 100, 125) | (85, 132, 157) | (95, 168, 193) | etc... |
| 49 | (119, 120, 169) | (133, 156, 205) | (147, 196, 245) | (161, 240, 289) | etc... |
| 81 | (207, 224, 305) | (225, 272, 353) | (243, 324, 405) | (261, 380, 461) | etc... |
Not all the members of these sequences are prime though, for instance (75,100,125) is (3,4,5) in disguise. The blue values in the table above aren't prime. This table doesn't contain our missing triples (8, 15, 17) and (20, 21, 29) or multiples thereof. It can't contain multiples as c-b in these cases is even, and no multiple of an even number is an odd square. This leads us to the second special case.
Which gives the series (mk, k2-n/2, k2+n/2), which generates
| n = 2 | (6, 8, 10) | (8, 15, 17) | (10, 24, 26) | (12, 35, 37) | etc... |
| 8 | (20, 21, 29) | (24, 32, 40) | (28, 45, 53) | (32, 60, 68) | etc... |
| 18 | (48, 55, 73) | (54, 72, 90) | (60, 91, 109) | (66, 112, 130) | etc... |
| 32 | (80, 84, 116) | (88, 105, 137) | (96, 128, 160) | (104, 153, 185) | etc... |
The examples start at the first k value where b > a. Blue entries show where there is a common factor.
Pythagoras.py also include the code for drawing the diagrams that appear on this page. I don't know if this algorithm generates every possible prime tipple but it seems quite complete. Also, the special cases could be tidied up a bit to avoid generating the composite triples shown in blue above.
A plot of the prime tripples out to (3200x3200). Each pixel represents a 10x10 cell. This is quite interesting as most of the points appear to lie on curves and there are 'special' points where three of these curves appear to intersect.
![]() |
The same area with the non prime triples (red) included. The straight lines are generated by multiples of the smaller triples like (3,4).
![]() |
And finally the prime triples shown out to (32000,32000). Each pixel now represents 100x100 points.
![]() |
If we take two complex numbers (a1,b1) and (a2,b2) and multiply them together we get a third complex number (a3,b3). If these numbers are interpreted as vectors then the lengths of the three vectors are related as L3 = L1 x L2. If L1 and L2 are integers then (a1,b1,L1) and (a2,b2,L2) are Pythagorean triples.
Expanding the multiplication out we get
Following the steps of the multiplication will show that a3, b3 and L3 must also be integers and form a triple. We can use this as another way of generating unlimited series of triples, for instance the powers of (3,4) are;
| (3 + 4i) ^ n = | A | B | C | C - B | Type | |
| (3 + 4i)^1 | (3 + 4i) | 3 | 4 | 5 | 1 | 1^2 |
| (3 + 4i)^2 | (-7 + 24i) | 7 | 24 | 25 | 1 | 1^2 |
| (3 + 4i)^3 | (-117 + 44i) | 44 | 117 | 125 | 8 | 8^2 / 2 |
| (3 + 4i)^4 | (-527 - 336i) | 336 | 527 | 625 | 98 | 14^2 / 2 |
| (3 + 4i)^5 | (-237 - 3116i) | 237 | 3,116 | 3,125 | 9 | 3^2 |
| (3 + 4i)^6 | (11753 - 10296i) | 10,296 | 11,752 | 15,625 | 3,872 | 88^2 / 2 |
| (3 + 4i)^7 | (76443 + 16124i) | 16,124 | 76,443 | 78,125 | 1,682 | 58^2 / 2 |
| (3 + 4i)^8 | (164833 + 354144i) | 164,833 | 354,144 | 390,625 | 36,481 | 191^2 |
| (3 + 4i)^9 | (-922077 + 1721764i) | 922,077 | 1,721,764 | 1,953,125 | 231,361 | 481^2 |
| (3 + 4i)^10 | (-9653287 + 1476984i) | 1,476,984 | 9,653,287 | 9,765,625 | 112,338 | 474^2 / 2 |
Although this series is unlimited the examples it generates are rather far apart. Only the first six appear in our diagrams above. It also shows that all powers of 5 are the square root of the sum of two squares. The C-B column enables us to verify that this triple would have been detected by one of the algorithms described above (n = c-b is an odd square or half an even square). The series generated by (5,12) shoots out of sight even more rapidly, but at the same time shows that all powers of 13 can also be represented as the are the square root of the sum of two squares.
| A | B | C | C - B | Type |
| 5 | 12 | 13 | 1 | 1^2 |
| 119 | 120 | 169 | 49 | 7^2 |
| 828 | 2,035 | 2,197 | 162 | 18^2 / 2 |
| 239 | 28,560 | 28,561 | 1 | 1^2 |
| 145,668 | 341,525 | 371,293 | 29,768 | 244^2 / 2 |
| 3,369,960 | 3,455,641 | 4826,809 | 1,371,168 | 1656^2 / 2 |
| 23,161,315 | 58,317,492 | 62,748,517 | 4,431,025 | 2105^2 |
| 13,651,680 | 815,616,479 | 815,730,721 | 114,242 | 478^2 / 2 |
| 4,241,902,555 | 9,719,139,348 | 10,604,499,373 | 885,360,025 | 29755^2 |
| 95,420,159,401 | 99,498,527,400 | 137,858,491,849 | 38,359,964,449 | 195857^2 |
When multiplying two different triples together there are two possible result sets, for instance multiplying the 64 permutations of (3,4,5) and (5,12,13) generates two sets based on (16, 63, 65) and (33, 56, 65).
| (33, 56, 65) | (16, 53, 65) |
|---|---|
|
(3+4j) x (5+12j) = (-33+56j) (3+4j) x (5+12j) = (-33+56j) (3-4j) x (5-12j) = (-33-56j) (3-4j) x (5-12j) = (-33-56j) (3+4j) x (5+12j) = (-33+56j) (3+4j) x (5+12j) = (-33+56j) (3-4j) x (5-12j) = (-33-56j) (3-4j) x (5-12j) = (-33-56j) (3+4j) x (12-5j) = (56+33j) (3+4j) x (12-5j) = (56+33j) (3-4j) x (12+5j) = (56-33j) (3-4j) x (12+5j) = (56-33j) (3+4j) x (12-5j) = (56+33j) (3+4j) x (12-5j) = (56+33j) (3-4j) x (12+5j) = (56-33j) (3-4j) x (12+5j) = (56-33j) (4+3j) x (5-12j) = (56-33j) (4+3j) x (5-12j) = (56-33j) (4-3j) x (5+12j) = (56+33j) (4-3j) x (5+12j) = (56+33j) (4+3j) x (5-12j) = (56-33j) (4+3j) x (5-12j) = (56-33j) (4-3j) x (5+12j) = (56+33j) (4-3j) x (5+12j) = (56+33j) (4+3j) x (12+5j) = (33+56j) (4+3j) x (12+5j) = (33+56j) (4-3j) x (12-5j) = (33-56j) (4-3j) x (12-5j) = (33-56j) (4+3j) x (12+5j) = (33+56j) (4+3j) x (12+5j) = (33+56j) (4-3j) x (12-5j) = (33-56j) (4-3j) x (12-5j) = (33-56j) |
(3+4j) x (5-12j) = (63-16j) (3+4j) x (5-12j) = (63-16j) (3-4j) x (5+12j) = (63+16j) (3-4j) x (5+12j) = (63+16j) (3+4j) x (5-12j) = (63-16j) (3+4j) x (5-12j) = (63-16j) (3-4j) x (5+12j) = (63+16j) (3-4j) x (5+12j) = (63+16j) (3+4j) x (12+5j) = (16+63j) (3+4j) x (12+5j) = (16+63j) (3-4j) x (12-5j) = (16-63j) (3-4j) x (12-5j) = (16-63j) (3+4j) x (12+5j) = (16+63j) (3+4j) x (12+5j) = (16+63j) (3-4j) x (12-5j) = (16-63j) (3-4j) x (12-5j) = (16-63j) (4+3j) x (5+12j) = (-16+63j) (4+3j) x (5+12j) = (-16+63j) (4-3j) x (5-12j) = (-16-63j) (4-3j) x (5-12j) = (-16-63j) (4+3j) x (5+12j) = (-16+63j) (4+3j) x (5+12j) = (-16+63j) (4-3j) x (5-12j) = (-16-63j) (4-3j) x (5-12j) = (-16-63j) (4+3j) x (12-5j) = (63+16j) (4+3j) x (12-5j) = (63+16j) (4-3j) x (12+5j) = (63-16j) (4-3j) x (12+5j) = (63-16j) (4+3j) x (12-5j) = (63+16j) (4+3j) x (12-5j) = (63+16j) (4-3j) x (12+5j) = (63-16j) (4-3j) x (12+5j) = (63-16j) |