4
$\begingroup$

I am looking for a method to generate Pythagorean Triples $(a,b,c)$. There are many methods listed on Wikipedia but I have a unique constraint that I can't seem to integrate into any of the listed methods.

I need to generate Pythagorean Triples $(a,b,c)$ such that:

$$a^2 + b^2 = c^2$$ $$a\lt b\lt c \,; \quad a,b,c \in \Bbb Z^+$$ $$and $$ $$b=a+1$$

Is there a way to modify one of the listed methods to include this constraint?

$\endgroup$
3
  • $\begingroup$ I wasn't sure how to tag this question, so please re-tag if necessary! $\endgroup$ Oct 3, 2013 at 0:40
  • $\begingroup$ $\large a = 3,\quad b = 4,\quad c = 5$, $\endgroup$ Oct 4, 2013 at 2:33
  • $\begingroup$ Your $a$ could be odd or even. Two different results: When $a$ is odd, triplet is $(3,4,5)$, $(119,120,169)$, or $(4059,4060,5741)$; When $a$ is even, only triplet I can think about is $(20,21,29)$. $\endgroup$ May 14, 2023 at 3:33

3 Answers 3

6
$\begingroup$

We give a way to obtain all solutions. It is not closely connected to the listed methods. However, the recurrence we give at the end can be expressed in matrix form, so has a structural connection with some methods in your linked list.

We want $2a^2+2a+1$ to be a perfect square $z^2$. Equivalently, we want $4a^2+4a+2=2z^2$, that is $(2a+1)^2-2z^2=-1$.

This is a Pell equation. One can give a recurrence for the solutions. One can also give a closed form that has a similar shape to the Binet closed form for the Fibonacci numbers.

Added: We can for example get all solutions by expressing $(1+\sqrt{2})^{2n+1}$, where $n$ is an integer, in the form $s+t\sqrt{2}$, where $s$ and $t$ are integers. Then $z=t$ and $2a+1=s$.

One can get a closed form from this by noting that $(1-\sqrt{2})^{2n+1}=s-t\sqrt{2}$. That gives us $$s=\frac{(1+\sqrt{2})^{2n+1} + (1-\sqrt{2})^{2n+1}}{2}.$$ There is a similar formula for $t$.

Remark: The following recurrence is probably more useful than the closed form.

If $(1+\sqrt{2})^{2n+1}=s_n+t_n\sqrt{2}$, then $(1+\sqrt{2})^{2n+3}=s_{n+1}+t_{n+1}\sqrt{2}$, where $$s_{n+1}=3s_n+4t_n,\qquad t_{n+1}=2s_n+3t_n.$$

This will let you quickly compute the first dozen or so solutions (the numbers grow fast). We start with $n=0$, which gives a degenerate triangle. For $n=1$, we get $s_1=7$, $t_1=5$, which gives the $(3,4,5)$ triangle. We get $s_2=41, t_2=29$, giving the triple $(20,21,29)$. And so on.

$\endgroup$
3
  • $\begingroup$ Could you link me to information regarding "the Binet closed form for the Fibonacci numbers?" $\endgroup$ Oct 3, 2013 at 0:46
  • 1
    $\begingroup$ OK, here it is. But maybe the material I am adding will help also. $\endgroup$ Oct 3, 2013 at 0:50
  • $\begingroup$ Thanks for all the great information! You have given me some new topics to learn about! $\endgroup$ Oct 3, 2013 at 15:34
3
$\begingroup$

Actually, it's there in the special cases section as Almost-isosceles Pythagorean triple, or when the non-hypotenuse sides differ by 1. The complete formula is,

$$\Big(\frac{x-1}{2}\Big)^2+\Big(\frac{x+1}{2}\Big)^2=y^2\tag{1}$$

where $x,y$ are solutions to the Pell equation,

$$x^2-2y^2 = -1\tag{2}$$

Since from $(2)$ one can tell that $x$ is always odd, then the terms of $(1)$ are integers.

$\endgroup$
1
$\begingroup$

To produce Pythagorean triples where $a^2 + b^2 = c^2$ and $b = a + 1$

Start with $n = 1$

$\sqrt{n(1 + \sqrt{2})^4}$

Round this down to an integer, then square it. This gets you $c^2$, which is $25$, so $c = 5$. Now take $c$ and divide it by $\sqrt{2}$. $\dfrac{c}{\sqrt{2}}$, rounded to the nearest half, is $3.5$. $a$ and $b$ are the integers on either side of $3.5$.

Now repeat the process with $n = c^2$, to be precise, $n = 25$:

$\sqrt{25(1 + \sqrt{2})^4}$ rounded down, squared, makes $841$, so $c = 29$. $\dfrac{c}{\sqrt{2}}$ rounded to the nearest half is $20.5$, so $a = 20, b = 21$

Again, repeat with $n = 841$ and keep repeating as long as you like, and you will find all of the infinite Pythagorean triples where $a^2 + b^2 = c^2$ and $b = a + 1$

Here's a really big one I found:

$a = 666554398276487455279750313289061631639$

$b = 666554398276487455279750313289061631640$

$c = 942650270102046130733437746596776286089$

I don't know if this is the kind of answer you were looking for, but I thought I'd share my method anyway.

Regards,

Josiah Hamilton

Edit: I had written "rounded to the nearest integer" but it was supposed to say "rounded DOWN ..."

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .