Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(Excuse me for my english: I'm spanish speaker)

"Find a three digit number $\overline{xyz}$ such that $x^2 +y^2 + z^2$ is equal to the number (xyz). "

I have this equation: $$x^2 -100x +(y^2-10y+z^2-z)=0$$

And the discriminant (in $x$):

$$\Delta_x = -4y^2 +40y-4z^2+4z+10000$$

Solutions for $x_i$ are: $$x_i = \frac{100 \pm \sqrt{\Delta_x}}{2}$$

in which ${\Delta_x} \geq 0$. The obvious conditions are:

i) $x \neq 0$ and $x=1,..., 9$;

ii) $y, z = 0, ..., 9$.

I need an orientation because pick $(y,z) \in \{0,...9\} \times \{0,...9\}$ I believe it's arduous task.

Another "attemp" from myself is to find $(x, y, z) \in \{1,...9\} \times \{0,...9\} \times \{0,...9\} $ such that

$$(x-50)^2 + (y-5)^2 +\left(z- \frac{1}{2}\right)^2 = \frac{10101}{4}$$ but I'm not skilfull in multivariable calculus :(

Any advice is welcome.

share|cite|improve this question
For starters, $x^2 + y^2 + z^2 \le 9^2 + 9^2 + 9^2 = 243$, so $x \le 2$. So you have to only try $x=1$ and $x=2$. – ShreevatsaR Mar 13 '12 at 16:18
In problems of this type, equations are not the way to go, it is more like detective work. – André Nicolas Mar 13 '12 at 16:26
I did a quick check on Wolfram Alpha and according to that the number of integer solutions are $320$ (Read carefully, 320 is not the solution, but there are 320 integer solutions). You might have to tell us which context (which book) or something of that sort then it will give a better idea about a shorter approach to solve this. – Kirthi Raman Mar 13 '12 at 16:40
up vote 4 down vote accepted

It seems that solving it for $y$ is a better idea, as we are going to have $y=5\pm\sqrt{something}$.

Let us solve it for a number with any number of digits: $\overline{...vwxyz}$.



Note, that $0\le y\le9$, therefore, $0\le(z^2-z)+(x^2-100x)+(w^2-1000w)+...\le25$.

But $z^2-z\le9^2-9=72$, while $x^2-100x\le1^2-100=-99$ for $1\le x\le9$, $w^2-1000w\le-999$ for $1\le w\le9$ etc.

Hence, $x=w=...=0$ and $25-z(z-1)$ is a square. For $z=0,1,2,3,4,5$ we get $25,25,23,19,13,5$ and only the first two are squares.

The only two numbers are $0$ and $1$.

share|cite|improve this answer
Really Nice! Thanks. – Mario De León Urbina Mar 14 '12 at 3:21

Since $x^2+y^2+z^2\leq 3\times 9^2 = 243$, we know that $x=0$, $x=1$, or $x=2$. But if $x=2$, then $x^2+y^2+z^2 \leq 2\times 9^2 + 4 = 166$, so we must definitely have $x=0$ or $x=1$.

But $x=1$ doesn't work: that would give us a maximum possible total of $1+9^2+9^2 = 163$; that would meant that $y\leq 6$; but then the best we can do is $1+6^2+9^2 = 118$, which means $y\leq 1$, but then we can't even get to $100$, since the maximum possible total would be $1+1+81$.

So we must have $x=0$.

Now we are down to $y^2+z^2 = 10y+z$, or $y^2 - 10y + (z^2-z) = 0$.

This means $y = 5\pm \frac{\sqrt{100 - 4(z^2-z)}}{2}$. So $100-4(z^2-z)$ must be an even square. So $z^2-z$ must be $0$, $9$, $16$, $21$, $24$, or $25$.

Since $z^2-z = z(z-1)$, with $0\leq z\leq 9$ integral, this means the total cannot be $9$, $21$, or $25$. If $z\gt 1$, then we cannot have a perfect square, which excludes $16$; and $24$ cannot be written as a product of consecutive integers, which only leaves $z^2-z=0$. Thus, $z=0$ or $z=1$. Both lead to $y=0$ or $y=10$, but the latter is impossible.

So the only possibilities are $000$ and $001$.

share|cite|improve this answer

I cheated and programmed :) It's only 0 and 1. For some related reference see:

The second sentence shows that there are no other for any integer.

share|cite|improve this answer

small Maple program :

for x from 0 to 9 do
for y from 0 to 9 do
for z from 0 to 9 do
if x^2+y^2+z^2 = 100*x+10*y+z then
end if;
end do;
end do;
end do;

There is no such $\overline{xyz}$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.