How many integers $n$ for $3<n<100$ are such that $1+2+3+\cdots+(n-1)=k^2$, with $k \in \mathbb{N^*}$?

103 Views Asked by At

I know that the sum $1+2+3+\cdots+(n-1)$ equals $\frac{(n-1)\cdot n}{2}$.

I wrote the equation in the two following forms:

$$(n-1)\cdot \frac{n}{2}=k^2$$ $$(n-1)\cdot n=2k^2$$

And I tried to find solutions by trial-and-error. I found $50$ through the first and $9$ through the second equation; and there seems to be no other solution as the answer to the question was $2$.

However, I certainly believe that there is a much more structured and methological method to solve the question that I am unfortunately unaware of.

How would you go about solving this question? Any help/hint/clue/solution would be greatly appreciated. Thanks.

2

There are 2 best solutions below

2
On

The general question of determining which triangle numbers (i.e. of the form $1+2+\dotsb+i$) are also squares is deeply related to the Pell-Fermat equation $x^2-2y^2=1$, thus it is non-trivial.

More precisely, the condition $n=\frac{t(t+1)}{2}=s^2$ is equivalent to $x^2-2y^2=1$ when setting $x=2t+1$ and $y=2s$, the values of $(x,y)$ are thus the $(x_k,y_k)$ given by $x_k+\sqrt{2}y_k=(3+2\sqrt{2})^k$, giving the values for $n$: $n_k=(y_k/2)^2$.

You easily get $s_{k+2}=6s_{k+1}-s_k$ with $(s_0,s_1)=(0,1)$, the numbers whose squares are also triangular numbers. The first ones are $0$, $1$, $6$, $35$, $204$ and $1\,189$.

2
On

As you have said, your sum is $\frac{(n-1)n}{2}$.

So, for the sum to be a perfect square, it should be of the form $4m$ if even, or $8m+1$ if odd, where $m$ is an integer.

Now, if $n=2a=\mathrm{even}$, then we have $$\frac{(n-1)n}{2}$$ $$=\frac{(2a-1)2a}{2}$$ $$=(2a-1)a$$ $$=2a^2-a$$

Now, if $n=2a+1=\mathrm{odd}$, then we have $$\frac{(n-1)n}{2}$$ $$=\frac{(2a)(2a+1)}{2}$$ $$=(2a+1)a$$ $$=2a^2+a$$

See if this helps you.