# Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way

Is there a formula that says if a number is the sum of 2 distinct nonzero squares ?

This is the sequence I'm trying to emulate: 5, 10, 13, 17, etc..

http://oeis.org/A004431 (Invalid it contains 85, etc..)

Need to make a program out of it, thanks in advance

I'm new here, sorry if the tags are somewhat lacking

EDIT: So this wasnt still the sequence I wanted. It must be the Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way. So my previous question didn't specify the exactly 1 way part.

http://oeis.org/A025302 (This is the one!)

• Possibly relevant is the Sum of Two-Squares theorem: en.wikipedia.org/wiki/Sum_of_two_squares_theorem – twnly Jan 20 at 2:53
• The theorem in question is that a number $n$ is sum of two squares if and only if: (if $p$ is an odd prime divisor of $n$, then either $p$ appears to an even power in $n$, or $p\equiv1\pmod4$.) So, $90=2\cdot3^2\cdot5=9+81$. I believe that you’ll find that every $2^{2k+1}$ is necessarily the sum of two equal squares. This may be enough for you to answer your question. – Lubin Jan 20 at 3:14
• @Lubin Yep that was it but I have one more specification. It can only have one way. Please see my edited question – Greggz Jan 20 at 13:48
• Well, think of $65=5\cdot13=1+64=49+16$. Two primes, two ways. I think there’s a multiplicative number-theoretic function that may be a key to this, but I don’t have time to think the matter over. – Lubin Jan 20 at 17:48
• Crossposted at: mathoverflow.net/q/321350/85967 – KonKan Jan 21 at 2:08