# Determine the integers $m$ such that $1+2+3+…m=$ a perfect square

I went like this

$$\frac{m(m+1)}{2} = k^2 ; m^2+m = 2k^2$$

From here I noticed that m is even that is $$m =2q$$ Substituting it will give

$$2q^2+q = k^2$$

From here I got no where..

Then I thought perfect square can be expressed as sum of consecutive odd number.I tried that way it too ended similarly. Any ideas for progress??

• The observation about $\ m\$ being even is not obvious. – Wlod AA Sep 15 '19 at 7:49
• It's even FALSE: $\ m=k=1\$ gives a counter-example. – Wlod AA Sep 15 '19 at 7:51
• Another quick solution is $\ m=8\$ with $\ k=6.$ – Wlod AA Sep 15 '19 at 7:55
• Oh thanks i forget m could be 1 mod 2 – Mathematical Curiosity Sep 15 '19 at 7:56
• Did you do it by trial and error?? – Mathematical Curiosity Sep 15 '19 at 7:57

So, $$4q^2+4q+1=2k^2+1$$, that is $$r^2-2k^2=1$$ where $$r=2q+1$$. This is a case of Pell's equation.

• Can any one tell me how to write in lines?? When I write it automatically merges all lines – Mathematical Curiosity Sep 15 '19 at 7:30
• Try pressing Enter to leave a line gap between places you want to have separate lines. – Minus One-Twelfth Sep 15 '19 at 7:38

The question can be said as there is a number which is the $$m$$th triangular number and also $$k$$th square number. Actually, there is a number called square triangular number. There is a sequence of finding the $$m$$ and $$k$$.

(Since only half of the solutions were addressed so far, or none sufficiently explicitly, let me provide all of them).

We have to solve

$$m\cdot(m+1)\ =\ 2\cdot k^2$$

i.e. $$\ 2\cdot k^2\ =\ L\cdot M\$$ where $$\ \{L\ M\}=\{m\,\ m+1\}\$$ is a product of two consecutive natural numbers. Then one of them, say $$\ M,\$$ has to be odd, and consequently, the other one, $$\ L,\$$ has to be even; it follows that $$\ L=2\cdot\lambda^2\$$ and $$\ M=\mu^2\$$ for certain natural numbers $$\ \lambda\ \mu.\$$ In effect, we obtain equation

$$|L-M| = 1$$ i.e. $$|2\cdot\lambda^2\ -\ \mu^2|\ =\ 1$$

It's well known (and not too hard to prove) that all solutions form the following sequence:

$$\lambda_0:=\mu_0:=1$$ and $$\forall_{n\in\mathbb N}\quad (\,\lambda_n:=\lambda_{n-1}+\mu_{n-1}\,\ \mbox{and} \ \ \mu_n:=\lambda_n+\lambda_{n-1}\,)$$ Thus, finally:

$$m_s :=\ \mu_s^2\qquad \forall\ s\ \mbox{odd}$$ and $$m_t :=\ 2\cdot\lambda_t^2\qquad \forall\ t\ \mbox{even}$$

and, of course,

$$\forall_{r\in\mathbb N}\quad k_r\ =\ \lambda_r\cdot\mu_r$$

provides all solutions $$\ (m\ k)\ :=\ (m_r\ k_r),\$$ where $$\ r\in\mathbb N$$.