Find n in sum that results in a number $aaa$

226 Views Asked by At

Lets say that we have the sum $1+2+3+\ldots+n$ where $n$ is a positive natural number and that this sum should equal a three digit number in which all the digits are the same, for example $111, 222,$ and so on.

What would be the best way to find the $n$ that would result in such a number? I guess you could solve $\frac{n(n+1)}{2}=111x$ but that seems a bit too hard.

From trial and error we know that the only solution is $n=36$ which gives $666$.

2

There are 2 best solutions below

2
On

Since $111=3\times37, \dfrac{n(n+1)}2=111x$ implies $37$ divides $n$ or $n+1$,

so we have to try only $n=36$ and $n=37$,

because, for $n\ge2\times37-1,$ $\dfrac {n(n+1)}2$ has more than $3$ digits.

3
On

$$\begin{align} \frac {n(n+1)}2&=111m\qquad (m=1,2,3,\cdots,9)\\ n^2+n-222m&=0\\ n&=\frac {-1\pm \sqrt{1+888m}}2\end{align}$$ Check for values of $m$ where $(1+888m)$ is a perfect square of an odd number.

The only solution is $m=6$, where $\sqrt{1+888m}=73$. This gives $$n=\frac {-1\pm 73}2=36\qquad (n>0)$$