TITLE: Find a primitive Pythagorean right triangle such that the difference of two shorter sides is 1, and every side is at least 100.
QUESTION [5 upvotes]: I am asked to find a primitive Pythagorean triple $(x, y, z)$ such that $x^{2}+y^{2}=z^{2}$ and $|x-y|=1$, and $x\geq100$ and $y\geq 100$.
I know the result should be x = 119, y = 120 and z = 169, but I don't know how to "find" it systematically.
By the theorem, we can have
$x=r^{2}-s^{2}$
$y=2rs$
$z=r^{2}+s^{2}$
I am stuck.
Ps: I found this question prove that there are infinitely many primitive pythagorean triples $x,y,z$ such that $y=x+1$
But where does the hint come from?

REPLY [3 votes]: You can generate Pythagorean triples where $B-A=\pm1$ in sequence with a seed Triple: $T_0=(0,0,1)$ using the following formula:
$$A_{n+1}=3A_n+2C_n+1\qquad B_{n+1}=3A_n+2C_n+2\qquad C_{n+1}=4A_n+3C_n+2$$
For example, it generates the following
$$T_1=(3,4,5)\qquad T_2=(20,21,29)\qquad T_3=(119,120,169)\qquad T_4=(697,696,985)$$
Another way to generate them directly is using Pell numbers that will feed Euclid's formula
$$P_n=\frac{(1+\sqrt2)^n-(1-\sqrt2)^n}{2\sqrt2}$$
This [Pell] function generates the series $1, 2, 5, 12, 29, 70, 169 ...$ and is a shoe-in for the $(r,s)$ pairs that generate $T_1, T_2, T_3 ...$ shown above. You  find them using $\quad r_x=P_{x+1}\quad s_x=P_x\quad $ to obtain the following pairs (excuse using the letter P to describe pairs instead of individual Pell numbers):
$$P_1=(2,1)\quad P_2=(5,2)\quad P_3=(12,5)\quad P_4=(29,12)\quad P_5=(70,29)\quad P_6=(169,70)\quad ...$$
Once you have these, you plug them into Euclid's formula:
$$A=r^2-s^2\qquad B=2rs\qquad C=r^2+s^2$$
and since you want all sides to be greater than $100$, you need only start with Pell-number $3$. Hope this helps.
The final formulas look like this:
\begin{equation}
 r_n= \frac{(1 + \sqrt{2})^{n+1} - (1 - \sqrt{2})^{n+1}}{2\sqrt{2}}\qquad \qquad\qquad
 s_n= \frac{(1 + \sqrt{2})^n - (1 - \sqrt{2})^n}{2\sqrt{2}}
 \end{equation} For example
${\small
 \begin{align*}
&\frac{(1 + \sqrt{2})^{2} - (1 - \sqrt{2})^{2}}{2\sqrt{2}}=2 & 
     \frac{(1 + \sqrt{2})^1 - (1 - \sqrt{2})^1}{2\sqrt{2}}=1,\space &  F(2,1)=(3,4,5)\\    
& \frac{(1 + \sqrt{2})^{3} - (1 - \sqrt{2})^{3}}{2\sqrt{2}}=5 &
     \frac{(1 + \sqrt{2})^2 - (1 - \sqrt{2})^2}{2\sqrt{2}}=2,\space &  F(5,2)=(21,20,29)\\
 & \frac{(1 + \sqrt{2})^{4} - (1 - \sqrt{2})^{4}}{2\sqrt{2}}=12 & 
      \frac{(1 + \sqrt{2})^3 - (1 - \sqrt{2})^3}{2\sqrt{2}}=5,\space & F(12,5)=(119,120,169)\\ 
 &\frac{(1 + \sqrt{2})^{5} - (1 - \sqrt{2})^{5}}{2\sqrt{2}}=29 &
     \frac{(1 + \sqrt{2})^4 - (1 - \sqrt{2})^4}{2\sqrt{2}}=12,\space & F(29,12)=(697,696,985)
 \end{align*} 
}$