# Three digits are added to a number. Find it.

Three digits have been added to a natural number A at its end (for example, 123 ->123456). The new turned out to be the sum of all natural numbers from 1 to A. How can I find A?

P.S. The sum of the numbers from 1 to A equals $\frac{A(A+1)}{2}$, but what to do next?

## 2 Answers

If $B$ is the number formed by the three added digits then the new number is $1000A+B$ and so $$1000A+B=\frac{A(A+1)}2\ .$$ This is easily rearranged to $$A(A-1999)=2B\ ;$$ it is also obvious from the conditions of the problem that $A>0$ and $0\le B\le999$. So we have $$A>0\ ,\quad 0\le A(A-1999)\le1998$$ and the only solution is $A=1999$.

Let's consider let $x$ be the three digit number that is added to the end of $A$. Then we can write $1000A+x=\frac{A(A+1)}{2}$. We can rewrite this as $A^2-1999A-2x=0$. The solutions of this equation (given by the quadratic formula) are $$A=\dfrac{1999\pm\sqrt{1999^2+8x}}{2}.$$ Now we just need to find a three digit integer $x$ such that $1999^2+8x$ is a perfect square, or $1999^2+8x=n^2$. We can rewrite this equation as $\frac{(n-1999)(n+1999)}{8}=x$. Since $x$ must be an positive integer, we need to choose some odd $n>1999$. The smallest choice is 2001, which yields $(2001-1999)(2001+1999)=8000$, so $x=1000$, which is not a three digit number, so $x$ cannot be nonzero. Thus, $x=0$. Plugging this into the above equation, we find $A=\frac{1999\pm\sqrt{1999^2}}{2}=0,1999$. Technically, $0$ does satisfy this if you are willing to accept $0=0000$. Otherwise, we only have $1999$, with $\frac{1999^2+1999}{2}=1999000$.