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$
Sequence: A067666, Sum of squares of prime factors of n (counted with multiplicity).
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$.
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, bad news.
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$$