Tool to generate Pythagorean triples. A Pythagorean triple is a set of three natural integer numbers (a,b,c), such that a^2+b^2=c^2
Pythagore Triple - dCode
Tag(s) : Arithmetics, Geometry
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
A Pythagorean triplet is a set of three natural numbers $ a $, $ b $ and $ c $ such that $ a^2+b^2=c^2 $
Example: (3,4,5) is a triplet of Pythagoras because $ 3^2+4^2=5^2 $
It exists heuristics to find a Pythagore Triple but the easiest method consists in testing iteratively all possibilities of a and b when s is given, the value of c is constrained by s=a+b+c.
The following equations can be deducted:
$$ a^2 + b^2 = (s − a − b)^2 \\ a <= (s − 3)/3 \\ b < (s − a)/2 $$
Example: If $ s = 12 $, then $ a <= 3 $ and $ b < 4.5 $, a quick test allows to find $ a = 3, b = 4 $ and get the triple $ \{3,4,5\} $.
Is (X,Y,Z) a Pythagorean triple? Use the checker above to find out. Otherwise, manually, take for a and b the 2 smallest values among X, Y, Z, and for c the largest value then calculate first $ a ^ 2 + b ^ 2 $ then $ c ^ 2 $ if the 2 values found are identical then (X, Y, Z) is a Pythagorean triplet, otherwise it is not a Pythagorean triple.
The first Pythagorean triples (side inferior to 100)
(3,4,5) | (5,12,13) | (6,8,10) |
(7,24,25) | (8,15,17) | (9,12,15) |
(9,40,41) | (10,24,26) | (11,60,61) |
(12,16,20) | (12,35,37) | (13,84,85) |
(14,48,50) | (15,20,25) | (15,36,39) |
(16,30,34) | (16,63,65) | (18,24,30) |
(18,80,82) | (20,21,29) | (20,48,52) |
(21,28,35) | (21,72,75) | (24,32,40) |
(24,45,51) | (24,70,74) | (25,60,65) |
(27,36,45) | (28,45,53) | (28,96,100) |
(30,40,50) | (30,72,78) | (32,60,68) |
(33,44,55) | (33,56,65) | (35,84,91) |
(36,48,60) | (36,77,85) | (39,52,65) |
(39,80,89) | (40,42,58) | (40,75,85) |
(42,56,70) | (45,60,75) | (48,55,73) |
(48,64,80) | (51,68,85) | (54,72,90) |
(57,76,95) | (60,63,87) | (60,80,100) |
(65,72,97) |
There is no Pythagorean triplet with 2 identical values. Indeed if 2 sides are $ a $ (natural integer), the last side is $ a \sqrt2 $ which can not be an integer.
Example: $ a = 1 $ the triplet becomes $ (1, 1, \sqrt2) $. By scaling, it is not possible to obtain an both isosceles and right triangle with integer sides.
dCode retains ownership of the "Pythagore Triple" source code. Any algorithm for the "Pythagore Triple" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Pythagore Triple" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Pythagore Triple" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Pythagore Triple" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Pythagore Triple on dCode.fr [online website], retrieved on 2025-04-16,