Can a number be equal to the sum of the squares of its prime divisors?

If $$n=p_1^{a_1}\cdots p_k^{a_k},$$ then define

$$f(n):=p_1^2+\cdots+p_k^2$$

So, $f(n)$ is the sum of the squares of the prime divisors of $n$.

For which natural numbers $n\ge 2$ do we have $f(n)=n$ ?

It is clear that $f(n)=n$ is true for the square of any prime, but false for the other prime powers.

If $p$ and $q$ are the only prime divisors of $n$, we would get $p^2+q^2\equiv 0\pmod p$, which implies $p=q$, so for numbers with exact two prime divisors, $f(n)=n$ cannot hold.

If $p,q,r$ are primes with $p<q<r$, then we have two possibilities.

If $p,q,r\ne 3$, we have $p^2+q^2+r^2\equiv 0\pmod3$, so $f(n)=n$ cannot hold. If $p=3$ or $q=3$, then $p^2+q^2+r^2 \equiv 2\pmod3$, so $p^2+q^2+r^2$ is not divisible by $3$, so $f(n)=n$ cannot hold.

Finally, if $p<q<r<s$, then if $p>2$, then $p^2+q^2+r^2+s^2\equiv 0\pmod4$, so $f(n)=n$ cannot hold. And if $p=2$, then $p^2+q^2+r^2+s^2\equiv 3\pmod4$, so $p^2+q^2+r^2+s^2$ is odd and $f(n)=n$ again cannot hold.

So, apart from the squares of the primes, the number must have at least $5$ prime factors. I searched to about $6\times 10^7$ and did not find a "non-trivial" example.

• Is there a number $n$ with at least two prime factors and $f(n)=n$ ?
• Similar question (but different of course). – user26486 Jun 2 '15 at 17:33
• I found no examples for $n\le 10 ^9$. – Peter Jun 2 '15 at 18:17
• A small remark (again): suppose $p_1\lt\cdots\lt p_m.$ Then $$mp_m^2\ge p_1^2+\cdots+p_m^2=p_1^{a_1}\cdots p_m^{a_m}\ge m!p_m^{a_m}.$$ Hence $a_m\le2.$ If $a_m=2,$ then $m\ge m!$ implies that $m=1,2,$ already discussed by you. So $a_m=1.$ But I failed to extend this argument to obtain satisfying results. – awllower Jun 3 '15 at 0:27
• You should have mentioned a proof of $p_1^{a_1}...p_{m-1}^{a_{m-1}}\ge m!$,but in fact, even the product of the first $m-1$ primes is at least $m!$ – Peter Jun 3 '15 at 10:01
• Well, it seems you already have a proof. ;-) – awllower Jun 3 '15 at 23:32

If $$f(n)=n$$ then $$p_1^{a_1} \cdot ... \cdot p_k^{a_k}=p_1^2+...+p_k^2$$.

From this it follows that $$p_1|p_2^2+...+p_k^2$$ and that $$p_k|p_1^2+...+p_{k-1}^2$$, that is, it is true that $$p_2^2+...+p_k^2=ap_1$$ and $$p_1^2+...+p_{k-1}^2=bp_k$$ for naturals $$a,b$$.

If those two equalities are subtracted then it is obtained $$p_1^2-p_k^2=bp_k-ap_1$$, which is equivalent to $$p_1(p_1+a)=p_k(p_k+b)$$.

If $$p_1$$ and $$p_k$$ are two different primes it follows that $$p_1 |(p_k+b)$$ and that $$p_k|(p_1+a)$$, so, there are integers $$c$$ and $$d$$ such that $$p_k+b=cp_1$$ and $$p_1+a=dp_k$$ and this implies $$p_1dp_k=p_kcp_1$$, that is $$c=d$$ and $$c>1$$.

If equalities $$p_k+b=cp_1$$ and $$p_1+a=cp_k$$ are added it is obtained $$a+b=(p_1+p_k)(c-1)$$.

Now, from $$(c-1)(bp_k-ap_1)=(p_1-p_k)(a+b)$$ it follows $$c=\dfrac{bp_1-ap_k}{bp_k-ap_1}$$ and because of $$bp_1 and $$-ap_k<-ap_1$$ it follows $$c=\dfrac{bp_1-ap_k}{bp_k-ap_1}<\dfrac{bp_k-ap_1}{bp_k-ap_1}=1$$, but this is not possible since $$c>1$$ so the assumption that $$p_1$$ and $$p_k$$ are different primes is false!

That means that necessarily $$k=1$$ and this settles the question.

• I could follow the proof until the line "Now, from $(c-1)$..." , please work our the last step more detailed. – Peter Jul 11 at 12:30
• @Peter $$p_1+p_k=\dfrac {a+b}{c-1}$$ and $$p_1^2-p_k^2=(p_1-p_k)(p_1+p_k)$$ – Grešnik Jul 11 at 12:36
• I think, I got it now! Well done! (+1) – Peter Jul 11 at 12:37
• @Peter Yes, it´s easy but tricky. – Grešnik Jul 11 at 12:41

Sorry because this isn't a full answer, but I believe that contains sustancials statments that could provide an improve from someone.

Let $d|n$, thus $n=d\cdot n/d$, and by symmetry $\prod_{d|n}d=\prod_{d|n}n/d$, multiply $\prod_{d|n}$ in first identity states $$\left( \prod_{d|n}d\right)^{2}=n^{\sigma_{0}(n)}$$ (this is Exercise 10, page 47 from Apostol, Introduction to Analytic Number Theory), where $\sigma_{0}(n)$ is the number of divisors function. My attempt is extract arithmetic information from this and Euler-Fermat Theorem. The following cases are disjoint with fullness for a collection of primes.

Case 1. We assume without loss of generality that the first prime is $2$, we obtain ($n>1$) $$\left( p_{1}^{2}+p_{2}^{2}+\cdots +p_{\omega (n)}^{2}\right)^{\sigma_{0}(n)}=n^{\sigma_{0}(n)}=\prod_{d|n}d^{2},$$ thus $(0+\omega (n)-1)^{\sigma_{0}(n)}\equiv 0\mod 4$, where $\omega (n)$ is the number of distinct primes, since if $m$ is odd, $m^{2}\equiv 1\mod 4$. These computations removes the cases $\omega(n)$ equals $4\lambda$ or $4\lambda +2$, there are infinitely many subcases.

Case 2. All primes are odd, we obtain with same idea $\omega (n)^{\sigma_{0}(n)}\equiv 1\mod 4$ and discard the same subcases (caution, removes subcases in this case).

Perhaps bounding or using another identities someone can to sweep more cases. I understand that this isn't the full answer, so I accept the response of community, yours or moderators.

• Thanks for vote up my partial answer. – user243301 Nov 8 '15 at 7:30

It's not a full answer, just remarks

• First

$a_k=1$ (as stated by Awllower)

$a_{k-1} = 1$

$k$ can't be even (obvious)

As stated by Peter $k$ can't be 3, and for the same reason $k$ can't be a multiple of 3, and for the same reason if $k=3x+2$ then 3 can't be a factor of $n$.

• Then

set $x=k$

we have $x*p_k^2>n$

<=> $x*p_k>\prod_{i=1}^{k-1} p_i^{a_i}$

<=> $x*p_k/\prod_{i=1}^{k-2} p_i^{a_i}>p_{k-1}$

so $p_k^2+(k-1)*(x*p_k/\prod_{i=1}^{k-2}p_i^{a_i})^2>n$

<=> $p_k^2*(1+(k-1)*(x/\prod_{i=1}^{k-2}p_i^{a_i})^2)>n$

Now if we try to get the lowest value for $x$, the limite is :

$x=1+(k-1)*(x/\prod_{i=1}^{k-2} p_i^{a_i})^2$

<=> $x={\prod_{i=1}^{k-2}p_i^{a_i}*(\prod_{i=1}^{k-2}p_i^{a_i}-\sqrt{(\prod_{i=1}^{k-2}p_i^{a_i})^2-4(k-1)})\over2(k-1)}$

numerical evaluation of $x$ for $k=5$ and $\prod_{i=1}^{k-2}p_i^{a_i}=2*5*7$ gives $x<1,0008177$

Hope it can help.

As awllower noted in comments, if $p_1<p_2<\ldots < p_k$, then $a_k=1$.

Then, based on this property, we rewrite numbers $n$ and $f(n)$ in the form: $$n = q\cdot p_k, \quad \mbox{ where} \quad q = p_1^{a_1}\cdots p_{k-1}^{a_{k-1}};\tag{1}$$ $$f(n) = p_k^2+f(q).\tag{2}$$ Then we focus on equation $$p_k^2+f(q) = q\cdot p_k,$$ which is quadratic equation (for variable $p_k$): $$p_k^2 - q\cdot p_k + f(q) = 0.\tag{3}$$ Then we require next conditions:
a) $q^2-4f(q) = D^2$, where $D \in\mathbb{N}$;
b) $\frac{q-D}{2}$ or $\frac{q+D}{2}$ is prime number.

This method allows to focus on smaller factors of a number $n$ and construct (?)(if possible) the largest appropriate prime factor.

But strange that I cannot find any such $q$ that at least condition a) holds: $$q^2-4f(q) = D^2.\tag{4}$$

($1<q<10^8$ were checked).

Not an answer, but another point of view

$\prod_{i=1}^{k}p_i^ai=\sum_{i=1}^kp_i^2=(\prod_{i=1}^{k}p_i^{ai-1})*(\prod_{i=1}^{k}p_i)$

So it's a Hurwitz equation (More complete but in French)

Lets call $A=\prod_{i=1}^{k}p_i^{ai-1}$

If there is a solution, for $k\gt2$ and $p_i\neq0$, we have $1 \leq A \leq k.$

We can put some restrictions on fundamentales solutions due to the fact that $p_1,p_2,...,p_k$ are distinct primes :

A fundamental solution can't contain coprimes.

A fundamental solution must contain all distinct primes of $A$.

There is no solutions if $k \equiv 0\bmod2$ or if $k \equiv 0\bmod3$.

The fundamental solutions for $k\leq10$ are (source post of the image) : So for $k\leq10$ the only possible fundamental solutions are :

$k=5,A=4,(1,1,1,1,2)$

$k=7,A=3,(1,1,1,1,1,2,3)$

I don't have a software to explore these fondamental solutions, but they may lead to a solution to the main question.

More generally, if $$f(n=p_1^{a_1} \cdot...\cdot p_k^{a_k})=p_1^m+...+p_k^m$$ and $$f(n)=n$$ then $$p_1^{a_1} \cdot ... \cdot p_k^{a_k}=p_1^m+...+p_k^m$$.

From this it follows that $$p_1|p_2^m+...+p_k^m$$ and that $$p_k|p_1^m+...+p_{k-1}^m$$, that is, it is true that $$p_2^m+...+p_k^m=ap_1$$ and $$p_1^m+...+p_{k-1}^m=bp_k$$ for naturals $$a,b$$.

If those two equalities are subtracted then it is obtained $$p_1^m-p_k^m=(p_1-p_k)(p_1^{m-1}+...+p_k^{m-1})=bp_k-ap_1$$, which, if $$p_1$$ and $$p_k$$ are different, is equivalent to $$\dfrac{bp_k-ap_1}{p_1-p_k}=p_1^{m-1}+...+p_k^{m-1}$$ and because $$b \leq a$$ it follows that $$\dfrac{bp_k-ap_1}{p_1-p_k}=p_1^{m-1}+...+p_k^{m-1} \leq \dfrac{ap_k-ap_1}{p_1-p_k}=-a$$ but this is not possible since $$a$$ is natural and $$p_1^{m-1}+...+p_k^{m-1}$$ is natural!

So $$p_1$$ and $$p_k$$ must be equal! In other words, if the number is equal to the sum of the powers of primes that are factors of that number then the number itself is the power of a prime!

(This is just the more simplified and more general version of my first answer to this question.)

• Again (+1) for the generalization and the simplification. – Peter Jul 12 at 10:23