3
$\begingroup$

Is there a trick for solving this problem about number of digits?

$ABC$ is a three-digit natural number, such that $ABC = A + B^2 + C^3$.

According to above equation what is $ABC$ ?

$\endgroup$
14
  • $\begingroup$ I suppose the equation is wrong, because $ABC$ means $A\times B \times C$. The first trick is to write $$100A+10B+C=A+B^2+C^3$$ $\endgroup$
    – miracle173
    Jan 3, 2015 at 19:24
  • 1
    $\begingroup$ You get four possibilities for $A, B, C$, no obvious trick though... $\endgroup$
    – Macavity
    Jan 3, 2015 at 19:25
  • 3
    $\begingroup$ @sinanakyazici searching down from $C=9$ makes it less exhaustive. You can then fix $A$, then see if there is a $B$ possible. Though not very elegant. $\endgroup$
    – Macavity
    Jan 3, 2015 at 19:31
  • 1
    $\begingroup$ There has to be a solution that is not trial & error. $\endgroup$
    – Auberon
    Jan 3, 2015 at 19:36
  • 3
    $\begingroup$ @Auberon, why?? $\endgroup$ Jan 3, 2015 at 19:50

2 Answers 2

4
$\begingroup$

The following is not really a trick, but at least it's a computation which can be done by hand.

First note that $10B\ge B^2$ (since $0\le B\le9$). Hence $$100A+10B+C=A+B^2+C^3\implies 99A+C<C^3$$ and since $A\ge1$, this gives us immediately that $C\ge5$.

Now, assume that $B=0$. Then we have $100A+C=A+C^3$, but since none of $5^3=125$, $6^3=216$, $7^3=343$, $8^3=512$, and $9^3=729$ are in the range $[100n-10,100n+10]$, there are no solutions with $B=0$, so from here on we assume $B\ne 0$

Now we have $10B>B^2+A$, so $100A<C^3$, and thus $A$ is at most the first digit of $C^3$, but since we also know $A$ must be at least the first digit of $C^3$ (easy to see from the original formulation of the problem), we have that $A$ is exactly the first digit of $C^3$.

Now all we have to do is solve $5$ quadratic equations for $B$ (one for each possible value of $C$) and see if there are integer solutions:

$C=5$:$$100+10B+5=1+B^2+125\implies B=3,7$$ $C=6$:$$200+10B+6=2+B^2+216\implies B=5\pm\sqrt{13}$$ $C=7$:$$300+10B+7=3+B^2+343\implies B=5\pm i\sqrt{14}$$ $C=8$:$$500+10B+8=5+B^2+512\implies B=1,9$$ $C=9$:$$700+10B+9=7+B^2+729\implies B=5\pm i\sqrt{2}$$

At long last this gives us the $4$ solutions $ABC\in\{135,175,518,598\}$.

$\endgroup$
4
$\begingroup$

We are searching for numbers $A,B,C \in \{0,1,2,3,4,5,6,7,8,9\}$ that satisfy $$100A+10B+C=A+B^2+C^3 \tag{1}$$ We can find the solution by checking all $1000$ possible tuples but I will try to shrink the number of tuples we have to check. We transform $(1)$ to $$99A+B(10-B)+C-C^3=0 \tag{2}$$ From this we get $$B(10-B) \equiv C^3-C \pmod {99} \tag{3}$$ We calculate the possible values for B and C

$$\tag{4}\begin{array}{r|r} B &B(10-B)\\ \hline 0&0\\ 1&9\\ 2&16\\ 3&21\\ 4&24\\ 5&25\\ 6&24\\ 7&21\\ 8&16\\ 9&9 \end{array} $$

$$\tag{5}\begin{array}{r|r|r} C &C^3-C&C^3-C \mod {99}\\ \hline{} 0&0&0\\ 1&0&0\\ 2&6&6\\ 3&24&24\\ 4&60&60\\ 5&120&21\\ 6&210&12\\ 7&336&39\\ 8&504&9\\ 9&720&27\\ \end{array} $$

Now we check which values of $B$ can be paired with values of $C$ because $$(B(10-B)) \mod 99 = (C^3-C) \mod 99$$ For $B$ the values of $B(10-B)$ and $B(10-B) \mod{99}$ are the same.

$$\tag{6}\begin{array}{c|c|c} B&C&C^3-C\\ \hline 0&0,1&0\\ 1,9&8&504\\ 3,7&5&120\\ 4,6&3&24 \end{array}$$

We analyze $(2)$ $\pmod{2}$. We have $$C^3-C \equiv 0 \pmod{2}$$ $$B(10-B) \equiv B \pmod{2}$$ $$99A \equiv A\pmod{2}$$ and therefore $$A \equiv B \pmod{2}$$ so the possible values can be reduced to

$$\tag{7}\begin{array}{c|c|c} B&C&A\\ \hline 0&0,1&0,2,4,6,8\\ 1,9&8&1,3,5,7,9\\ 3,7&5&1,3,5,7,9\\ 4,6&3&0,2,4,6,8 \end{array}$$

From $(5)$ we see that all possible values of $C^3-C$ are multiples of 24 so we can analyze $(2)$ $\pmod{24}$ and get

$$3A+B(10-B)=0 \pmod{24} \tag{8}$$

so $(7)$ can be reduced further to

$$\tag{9}\begin{array}{c|c|c} A&B&C\\ \hline 0,8&0&0,1\\ 5&1,9&8\\ 1,9&3,7&5\\ 0,8&4,6&3 \end{array}$$

Now we can check this $14$ possibilities or we estimate the size of some digits similar to @Peter Woolfitt's answer. From table $(4)$ we conclude that the minimum of $B(10-B)$ is $0$ and so from $(2)$ we get

$$99A \lt C^3-C \tag{10}$$

and further with the maximum of $C^3-C$ from table $(5)$ $$99A \le 720 $$ $$ A \le \frac{720}{99}=7^3/_{11}$$ $$A \le 7 \tag{11}$$

If we assume that $A \ge 1$ then from $(19)$ we get $$99 \lt C^3-C \tag{12}$$ and so $$C \ge 5 \tag{13} $$

So from table $(9)$ the following remains

$$\tag{14}\begin{array}{c|c|c} A&B&C\\ \hline 5&1,9&8\\ 1&3,7&5 \end{array}$$

Now you only have to check that these are valid solutions.

If we allow for $A$ the digit $0$ then we cannot establish $(12)$ and $(13)$.

But if $A=0$ we get from $(2)$ the equation $$B(10-B)=C^3-C \tag{15}$$

and by comparing the values of $(4)$ and $(5)$

$$\tag{17}\begin{array}{c|c|c} A&B&C\\ \hline 0&0&0,1\\ 0&4,6&3 \end{array}$$

All the possible combinations from $(14)$ and $(17)$ satisfy $(1)$, so we get the following solutions: $$ 518\\ 598\\ 135\\ 175 $$ Solutions with trailing zeros (and therefore these are not three digit numbers): $$ 000\\ 001\\ 043\\ 063 $$


Of course the solution can be easily calculated by a Python program:

for A in range(10):
    for B in range(10):
        for C in range(10):
            if 100*A+10*B+C==A+B**2+C**3:
                print(100*A+10*B+C)
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .