<s>[INST] Find all naturals $n>1$, such that the value of the sum $2^2 +3^2 +4^2 +\cdots+n^2$ equals $p^k$ where $p$ is a prime and $k$ is natural I simplified the sum using the formula of the sum of the squares
$$\frac{(n-1)(2 n^2 + 5n+6)}{6}=p^k$$ 
Moreover $\gcd(n-1,2n^2+5n+6)=1$ or $13$
I need help to complete the solution.
 [/INST] You have done most of the work. If the gcd is 1, then $n-1$ must be 1,2,3 or 6. It is easy to check that $n=2,3,4,7$ are solutions (giving $k=2,p=2$ and $k=1$ and $p=13,29,139$).
Otherwise, we must have $p=13$ and $k>1$. We cannot have $13^2|n-1$, because if $13^2|2n^2+5n+6$, then $13$ is not the gcd, so $2n^2+5n+6<6\cdot13<13^2=n-1$, which is clearly false. So $n=13+1,2\cdot13+1,3\cdot13+1$ or $6\cdot13+1$. It is easy to check that none of these values work.
Case 1. $n=13+1$. We must have $2n^2+5n+6=6\cdot13^m$, so $$2\cdot13^2+9\cdot13+13=6\cdot13^m$$ which is impossible (any number has a unique representation base 13. So it is not a solution.
Case 2. $n=2\cdot13+1$. We must have $2n^2+5n+6=3\cdot13^m$, so $$8\cdot13^2+13^2+5\cdot13+13=3\cdot13^m\text{ or }9\cdot13^2+6\cdot13=3\cdot13^m$$ That is again impossible for the same reason.
Case 3. $n=3\cdot13+1$. In a similar way we get $$13^3+5\cdot13^2+2\cdot13^2+13^1+13=3\cdot13^m$$ which is again impossible.
Case 4. $n=6\cdot13+1$. In a similar way we get $$5\cdot13^3+7\cdot13^2+4\cdot13^2+3\cdot13=6\cdot13^m$$ which is again impossible.
</s>