I am writing an algorithm to generate pythagorean triplets and I was going to use Euclid's theorem, however I have been unable to make it generate the first pythagorean triplet namely (3,4,5). Is this a limitation of the theorem? Does this occur for any higher values? I realise I am probably doing something stupid I appreciate the assistance.
2026-04-04 19:56:07.1775332567
On
Is it possible for Euclid's theorem to generate 3 4 5?
71 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
There are 2 best solutions below
0
On
Euclid's formula states that for any pair of integers $(m,n)$ with $m>n\geq1$, the triple $(a,b,c)=(m^2-n^2,2mn,m^2+n^2)$ is a Pythagorean triple.
The smallest choice for $n$ is $n=1$, and when $n=1$ the smallest choice for $m$ is $m=2$. Plugging those two values into Euclid's forumla gives:
$$(a,b,c)=(2^2-1^2,2\cdot 2\cdot 1,2^2+1^2)=(4-1,4,4+1)=(3,4,5).$$
Assuming you're using Euclid's formula correctly then it should be able to generate $(3,4,5)$.
I guess what you call Euclid's formula is $$A = 2mn, B = m^2- n^2 \mbox{ and } C = m^2+ n^2.$$ Setting $m=2$ and $n=1$ produces the Pythagorean triplet $(3,4,5)$.