Is there any formula to calculate the number of different Pythagorean triangle with a hypotenuse length $n$, using its prime decomposition?

259 Views Asked by At

Lets define $N(n)$ to be the number of different Pythagorean triangles with hypotenuse length equal to $n$.

One would see that for prime number $p$, where $p=2$ or $p\equiv 3 \pmod 4$, $N(p)=0$ also $N(p^k)=0$.

e.g. $N(2)=N(4)=N(8)=N(16)=0$

But for prime number $p$, where $p\equiv 1 \pmod 4$, $N(p)=1$ and $N(p^k)=k$.

e.g. $N(5)=N(13)=N(17)=1$ and $N(25)=2$ and $N(125)=3$

If $n=p^kq_1^{a_1}\dots q_r^{a_r}$, where $p$ be a prime of the form $ 4k+1$ and $q_i$'s be primes of the form $4k+3$ or be equal to $2$, then $N(n)=k$.

e.g. $N(14000)=N(5^3\times 2^4 \times 7)=3$

And also, If $n=p_1p_2q_1^{a_1}\dots q_r^{a_r}$, where $p_1$ and $p_2$ be primes of the form $ 4k+1$ and $q_i$'s be primes of the form $4k+3$ or be equal to $2$, then $N(n)=4$.

e.g. $N(65)=N(85)=4$

The question is:

Is there any formula to calculate $N(n)$, where $n=p_1^{a_1}\dots p_r^{a_r}$, by means of $N(p_1)$, … , $N(p_r)$?

1

There are 1 best solutions below

3
On

A more general question is to compute $r_2(n)$, the number of ways an integer $n$ can be written as the sum of two squares (not ignoring order, and including negative numbers and $0$; this makes the answer nicer). The answer is classical and due to Jacobi: it turns out that

$$r_2(n) = 4 \left( d_1(n) - d_3(n) \right)$$

where $d_1(n)$ is the number of divisors of $n$ congruent to $1 \bmod 4$ and $d_3(n)$ is the number of divisors of $n$ congruent to $3 \bmod 4$. From here it's not much harder to ignore $0$, negative numbers, and order, but it makes the answer a bit less nice.

So the answer is something like $N(n)=\frac12[(2a_1+1)\dots(2a_r+1)-1]$ but just in case $n=p_1^{a_1}\cdots p_r^{a_r}$, where $p_i$'s are prime and $p_i\equiv 1 \pmod 4$, for $i=1,\dots,r$.