# 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,

• have a look at (oeis.org/A067793) – Jean Marie May 10 '17 at 0:08
• $$\frac{(n+1)(2n+1)}{6}=x^2$$ $p_0=2 ; s_0=1$ $$p_2=2p+3s$$ $$s_2=p+2s$$ $$n=\frac{p^2}{2}-1$$ $$x=\frac{ps}{2}$$ – individ May 10 '17 at 4:59

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.

• I tried earlier to do this, firstly using $n\equiv 1 mod(6)$ secondly using induction i.e. finding some $\alpha$ such that $P(\alpha \times (n+1)(2n+1)$ is a square number provided that $P(n)$ is square number. – Stikawi May 9 '17 at 23:36
• I'll add a little bit more of a hint to my answer. – Franklin Pezzuti Dyer May 9 '17 at 23:49
• Thank you for your response, I think that $n=\frac{6-a^2}{2a^2-6}$. Also, I can show that the equation $(2n+1)a^2-6(n+1)=0$ admits always a solution in $\mathbb{R}$ or the function $x\mapsto \frac{6-x^2}{2x^2-6}$ is increasing in $[-\sqrt{6},-\sqrt{3})\cup(\sqrt{3},\sqrt{6}]$ to $[0,\infty)$ that is there exist an infinite integers $n$ such that $x\mapsto \frac{6-x^2}{2x^2-6}=n$. I have a more question, how can I find the $n$ such that $P(n)$ is perfect square ? since I can get $a=\frac{\sqrt{65}}{5}$ and find $n=4$ but is not make $P(n)$ a perfect square. Thank you again. – Stikawi May 10 '17 at 15:57

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$.

• Dear Ahmad, your sequence of $n$ is not prime numbers. And how could I find this formula of $n$ and show it is an integer ? – Stikawi May 9 '17 at 23:40
• @Stikawi i know my sequence is not a prime numbers but they produce integer when you plug them in your summation $\frac{1^2+2^2+\cdots+n^2}{n}$ contrary to your conclusion that it must be prime to produce an integer, secondly i solved it using Wolfram Alpha with the constrains that it must be integers, and the solution that i posted is the solution I've got. – Ahmad May 9 '17 at 23:46
• This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – Smylic May 10 '17 at 0:10
• @Smylic I don't actually see much wrong with this answer. It is vague, sure... but it is correct, and points out the flaw in the OP's logic. Regardless, there is enough content here that it's more than a comment – Brevan Ellefsen May 10 '17 at 0:13
• I agree with @Brevan Ellefsen. Besides, It would be interesting to understand the reason of the presence of these $7\pm\sqrt{3}$ logically coming from a second order recurrence relationship of the form $u_{n+2}=14 u_{n+1}-u_n$. – Jean Marie May 10 '17 at 0:14