Natural numbers equal to the sum of the squares of their four smallest divisors

diophantine equationsdivisibilitynumber theoryprime numbers

I was in the process of answering this question when I fell asleep; when I woke up, I found that the question has been closed for being too vague:

Find all positive integers

Anyhow, the mathematical problem is as follows:

Given a natural number $n > 0$, let $1$, $a$, $b$, and $c$ be the smallest four divisors of $n$, such that $1 < a < b < c$. Find all possible natural numbers $n$ such that $1^2 + a^2 + b^2 + c^2 = n$.

Best Answer

$n$ must be even, because if it were odd the four divisors would be odd and the sum of squares would be even.

The two smallest divisors are $1$ and $2$. $n$ cannot be a multiple of $4$ because if the fourth divisor is $p$ we have $n=1^2+2^2+4^2+p^2=21+p^2$ and squares $\bmod 4$ are $0,1$ so the right cannot be a multiple of $4$.

If the four smallest divisors were $1,2,p,q$ for $p,q$ prime the sum of squares would be odd, so the four smallest divisors are $1,2,p,2p$ for $p$ an odd prime.

If $n$ has a factor $3$, the four smallest divisors would be $1,2,3,6$ but then $n=50$ and it is not divisible by $3$.

$n=1^2+2^2+p^2+(2p)^2=5(p^2+1)$. As $n$ has a factor $5$, $p$ must be $5$. This gives $n=130$ as the only solution.