Counting Pythagorean Triples Calculate the number of Pythagorean triples whose hypotenuses $(=c)$ are less than or equal to $N$.
For example for $N = 15$ there are four Pythagorean triples: $$(3,4,5), \quad (5,12,13),\quad (6,8,10),\quad (9,12,15)$$
 A: For any $m,n$ with $\gcd(m,n)=1$ and $m>n>0$, the expressions
$a=m^2-n^2 \\
b = 2mn\\
c=m^2+n^2\\
$
give a primitive Pythagorean triple $(a,b,c)$. So $(m,n)=(2,1)$, for example, gives the standard $(a,b,c)=(3,4,5)$.
Then you can also multiply $(a,b,c)$ by some value $k>1$ to give additional non-primitive triples that will not be generated above.
Using these ideas together you can quickly find all Pythagorean triples to a given limit, expecially since as you can see you need $m^2 < c_{\text{limit}}$
A: HINT
For any Pythagorean triple we have that $c = k(m^2 + n^2)$ for some whole numbers $k$, $m$, and $n$
A: You can find all the triples you seek using the formula show below. It shows solving the C-function of Euclid's formula for $n$ and the range of $m$ values that may or may not yield integers for $n$. For integers found, the $m,n$ combination will yield a triple using Euclid's formula.
You will need to try every value of $C$ from $5$ to $N$ but it will find all the primitives, doubles and square multiples of primitives where the hypotenuse is less than or equal to $N$. For the factors of $N$, you then multiply as in your example $3(3,4,5)=(9,12,15)$.

