Problem with square number I have a doubt with this problem :
"Show that there exist an infinite number of integers $n$ such that $$P(n)=\frac{\sum_{k=0}^{n}k^{2}}{n}=\frac{1^{2}+2^{2}+\cdots+n^{2}}{n}$$ is square number."
I find that $P(n)$ is integer if $n$ is prime number.
Sincerely,
 A: The formula for the sum of the first $n$ square numbers is given by
$$1^2+2^2+...+n^2=\frac{n(n+1)(2n+1)}{6}$$
Meaning that
$$P(n)=\frac{\frac{n(n+1)(2n+1)}{6}}{n}$$
$$P(n)=\frac{(n+1)(2n+1)}{6}$$
So now you just need to find out when 
$$\frac{(n+1)(2n+1)}{6}$$
is a perfect square. Now let $a$ and $b$ be some two numbers (not necessarily integers) so that $ab=6$. Then $P(n)$ is a perfect square whenenver
$$\frac{n+1}{a}=\frac{2n+1}{b}$$
which can be solved for $n$ to get
$$n=\frac{b-a}{2a-b}$$
Now, by substitution, since $ab=6$, we have that
$$n=\frac{\frac{6}{a}-a}{2a-\frac{6}{a}}$$
$$n=\frac{6-a^2}{2a^2-6a}$$
Now all you need to do is show that there are an infinite number of numbers (not necessarily integers) $a$ so that
$$n=\frac{6-a^2}{2a^2-6}$$
is an integer. 
A: First its not true that $\frac{\sum \limits_{k=0}^{n} k^2}{n}$ is integer just when $n$ is a prime number, for example, when $n=1,25,35,49,55,65,77,85,91,95$.
Secondly, we get a perfect square when $n=\frac{1}{4} \left(\frac{1}{2} \left(\left(7-4 \sqrt{3}\right)^{2 c+1}+\left(7+4 \sqrt{3}\right)^{2 c+1}\right)-3\right)$ for any positive integer $c$.
