# When are $n$ and $2n$ both sums of two squares?

Given a natural number $n$, can we completely characterize when $n$ and $2n$ are each a sum of two squares?

For example: $446,382,709=(13010)^{2}+(16647)^{2}$ and $892,765,418=2(446,382,709)=(3637)^{2}+(29657)^{2}$

Do these imply, perhaps, that 446,782,709 is the hypotenuse of a primitive pythagorean triple?

(I found this question on a slip of paper while cleaning my office. It turns out that a trivial algebraic identity resolves the question...beyond Euler's characterization of when a natural number is the sum of two squares. Is the question nontrivial if we replace $2n$ by $3n$ above?)

EDIT: The modification is trivial, too. This is my fault, as I didn't think about my question before posting it. (This was a problem found on a slip of paper in my office. I posted it because it looked like a fun problem for students. This is certainly not the best forum for such things!!!)

-
Oddly, though, people like this problem more than many of the ones I HAVE thought about and posted on MO. Perhaps I should take a hint! :) – Jon Bannon Mar 9 '11 at 1:03

## 2 Answers

A natural is the sum of two squares iff every prime of the form $\rm\:4\:k+3$ occurs to even power in its prime factorization (iff the same is true for $\rm\:2\:n\:$). Note $\rm\ n = x^2 + y^2\ \Rightarrow\ 2\:n = (x+y)^2 + (x-y)^2$ which arises by compositions of forms, or, in linear form, with the norm $\rm\ N(a+b\ i)\ =\ a^2 + b^2$

$$\rm 2\ (x^2+y^2)\ =\ N(1+i)\ N(x-y\ i)\ =\ N((1+i)\ (x-y\ i))\ =\ N(x+y + (x-y)\ i)$$

-
Silly me! Simple algebraic identity gets them all... – Jon Bannon Jan 3 '11 at 14:46
Hi Bill! Is there anything interesting to be said if we replace 2n by 3n above? – Jon Bannon Jan 3 '11 at 14:54
@Jon: at most one of n or 3n can be written as a sum of squares, but not both. This follows from the criterion Bill gives. It sounds like you are not aware of the classical theory of factorization in the Gaussian integers: en.wikipedia.org/wiki/Gaussian_integer – Qiaochu Yuan Jan 3 '11 at 14:56
@Jon: HINT $\$ Apply the mentioned criterion noting that the exponents of $\:3\:$ in the prime factorizations of $\rm n$ and $\rm 3n$ have opposite parity. – Bill Dubuque Jan 3 '11 at 15:00
Hi Qiaochu. Thanks for the link! I posted the question because it looked like fun for youngsters. I must confess I hadn't thought at all about it before posting it. – Jon Bannon Jan 3 '11 at 15:00

$2(a^2 + b^2) = (a + b)^2 + (a - b)^2$. And, of course, the classification of numbers which are the sums of two squares is well-known (it is necessary and sufficient that if $p \equiv 3 \mod 4$, then the largest $k$ such that $p^k | n$ is even).

-
Thanks, Qiaochu! Bill got there first, though. – Jon Bannon Jan 3 '11 at 14:48