2017-09-30 11:03:38 +08:00

25 lines
333 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

毕达哥拉斯数可以由如下公式得出
$$
a=2mn \\
b=m^2-n^2 \\
c=m^2+n^2
$$
显然 $m>n$ ,因此不妨设 $m=n+k$ ,则
$$
a=2n^2+2nk \\
b=k^2+2nk \\
c=2n^2+2nk+k^2
$$
所以 $a+b+c=4n^2+6nk+2k^2$ 。
$4n^2+6n+2<N$ 所以
$$
n<\frac{\sqrt{4N+1}-3}{4}
$$
$2k^2+6nk+4n^<N$ 所以
$$
k<\frac{\sqrt{2N+n^2}-3n}{2}
$$