0
$\begingroup$

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)$$

$\endgroup$
1
$\begingroup$

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}}$

$\endgroup$
0
$\begingroup$

HINT

For any Pythagorean triple we have that $c = k(m^2 + n^2)$ for some whole numbers $k$, $m$, and $n$

$\endgroup$
  • $\begingroup$ maybe some moreee please :) $\endgroup$ – Nadfrw Mar 29 '17 at 20:04
  • $\begingroup$ @Nadfrw I don't have much more .. other than to say that this will probably not be a nice function. Basically, for any given $n$, you would have to find all $k$ that divide $n$, and if it does, find all pairs of perfect squares $m^2$ and $n^2$ such that $m^2 + n^2 = \frac{n}{k}$. Your best option is really a computer program, as suggested in the comments. But at least with this equation, the search space will be significantly reduced in comparison to working with $c^2 = a^2 + b^2$ directly. $\endgroup$ – Bram28 Mar 29 '17 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.