# Interesting thing about sum of squares of prime factors of $27$ and $16$.

Let $$n=p_1×p_2×p_3×\dots×p_r$$ where $$p_i$$ are prime factors and $$f$$ is the functions $$f(n)=p_1^2+p_2^2+\dots+p_r^2$$ If we put $$n=27,16$$ and $$27=3×3×3$$, $$16=2×2×2×2$$ then $$\begin{split}f(27)&=3^2+3^2+3^2=27\\f(16)&=2^2+2^2+2^2+2^2=16.\end{split}$$ I checked it upto $$n=10000$$, I did not find another number with this property $$f(n)=n$$.

Can we prove that other such numbers do not exist?

Some approaching values

$$f(992)=981\\f(1058)=1062\\f(1922)=1926\\f(5396)=5410\\f(7198)=7206\\f(9506)=9511$$

Edit

We can show there are infinitely many $$n$$ s.t. $$f(n)=n+4$$

Proof: put $$n=2\cdot p^2$$ where $$p$$ prime number

gives $$f(2\cdot p^2)=2^2+p^2+p^2=4+2\cdot p^2$$.

• This could be as hard as finding perfect numbers, but I am not sure. – Elliot G Mar 3 '20 at 19:37
• Just a though : assume $f(n) = n$ then $n = f(n) \ge r n^{1/r}$ so $n\ge rn^{1/r}$. Maybe this will lead to something? – infinity Mar 3 '20 at 19:43
• Upto $10^7$ , the only solutions are $16$ and $27$ – Peter Mar 3 '20 at 19:54
• Upto $10^8$ , the only solutions are 16 and 27 – Peter Mar 3 '20 at 20:07
• @infinity Brute force (PARI/GP-calculation), but I will also try to find some other necessary conditions. – Peter Mar 3 '20 at 20:35

For two factors $$f(pq)=p^2+q^2\gt pq$$ so $$pq$$ is not a solution.
For three factors: If $$3$$ is a factor then $$3^2+p^2+q^2$$ is only a multiple of $$3$$ if $$p=q=3$$ as well. If $$3$$ is not a factor then $$p^2=q^2=r^2=1\pmod3$$, so the sum is a multiple of $$3$$, and $$pqr$$ is not a solution. So $$27$$ is the only solution with three factors.
For four factors, they can't all be odd as the sum would be even. Then there must be an even number of odd factors. So it is a multiple of $$4$$, and looking $$\pmod4$$, the factors are either all odd or all even. So $$16$$ is the only solution with exactly four factors.
For five factors, I think they must all be odd; so $$n=5\pmod8$$.
For six factors, two of them must be 2, three must be 3, leaving $$35+p^2=108p$$ which has no solution.
For eight factors, all of them must be even, but $$256$$ doesn't work so there is no solution.
Edit:
Good news: $$3^2+3^2+5^2+1979^2+89011^2\\=3×3×5×1979×89011$$
Bad news: $$89011$$ is not prime.
My idea was that the equation is a quadratic in the final prime. The quadratic's discriminant must be a perfect square, and that is a Pellian equation in the second-last prime. If the other primes are $$3,3,5$$, this Pellian has solutions $$1,44,1979,89011,...$$ with $$a_{n+1}=45a_n-a_{n-1}$$
If two consecutive terms are prime, then I think $$3×3×5×a_n×a_{n+1}$$ is a solution to the current problem

EDIT: Let $$\alpha=\frac12(\sqrt{47}+\sqrt{43}),\beta=\frac12(\sqrt{47}-\sqrt{43})\\ A = \frac1{\sqrt{47}}(\alpha^{107}+\beta^{107}),B=\frac1{\sqrt{47}}(\alpha^{109}+\beta^{109})$$ $$A$$ and $$B$$ are consecutive terms from the sequence in the previous edit. Maple confirms that $$A$$ and $$B$$ are prime, and $$3\times3\times5\times A \times B=3^2+3^2+5^2+A^2+B^2$$

• Thanks, very interesting solution A and B. How did you get it? – Pruthviraj Mar 16 '20 at 12:56
• For the first edit, I looped through odd numbers, checking the sum but not primeness. I needed five odd factors, and zero or two 3s, so start 3,3,5. Then 3,3,5,1979 led to a quadratic with roots 44 and 89011, and playing around gave the sequence. For the second edit, I first used Matlab to find $a_n\pmod p$ for all primes up to $10^8$. Several $a_n$ were multiples of none of the $p$, and so were possibly primes. I got Maple to check $A$ and $B$ because they are adjacent in the list. The formula comes because $\alpha^2$ and $\beta^2$ are roots of the characteristic equation – Empy2 Mar 16 '20 at 13:11

Just some ideas, maybe useful to obtain a proof.

Let's focus on integers of the form $$p^k$$, where $$\,p\,$$ is prime. If $$p^k$$ satisfies the request, then $$f(p^k)=kp^2=p^k$$ $$k=p^{k-2}\;\;\;\;\;\;\;(1)$$ So $$\,p\,$$ divides $$\,k\,$$ and it's easy to see that the only solutions of $$\,(1)\,$$ are $$\,(k,p)=(3,3)\,$$ and $$\,(k,p)=(4,2)$$. More precisely (as requested by Peter), exists a certain $$\,\alpha$$ such that: $$k=p^\alpha=p^{(p^\alpha -2)}$$ $$\alpha=p^\alpha -2$$ $$\alpha+2=p^\alpha\ge2^\alpha\;\;\;\;\;\;\;(2)$$ and the only solutions of $$\,(2)\,$$ are indeed $$\,\alpha=1\,$$ and $$\,\alpha=2$$.

Further, if $$\,q\cdot p^k$$ (with $$\,q\,$$ prime different from $$\,p$$) satisfies the request, then $$f(q\cdot p^k)=f(p^k)+q^2=q\cdot p^k\;\;\;\;\;\;\;(3)$$ From $$\,(3)\,$$ we see that necessarily $$\,q\,$$ has to divide $$\,f(p^k)$$.

• "It is easy to see" - please work this out. – Peter Mar 3 '20 at 21:25
• Please, remove the downvote (see corrections to my post). Thanks. – Augusto Santi Mar 3 '20 at 21:54

Giorgos Kalogeropoulos has found 3 such numbers, each having more than 100 digits.
You can find these numbers if you follow the links in the comments of OEIS A339062 & A338093

So, such numbers exist! It is an open question if there are infinitely many of them...