Code to zero
Problem
Find all the 3 digit numbers such that by adding the first digit, the square of the second digit and the cube of the third digit you get the original number, for example $1 + 3^2 + 5^3 = 135$. Can you find ways of reducing the search so that you do not need to test 900 cases?
[This problem appears in Ken Follett's spy thriller of the same name].
Getting Started
Can you use your knowledge of place value to write down an algebraic relation linking $a$, $b$ and $c$?
Student Solutions
Vassil of Lawnswood High School in Leeds sent in a good solution. He worked systematically through the possible values of c using the rearrangement c(c$^2$ -1) = b(10-b) + 99a to establish the range of possible values for a and then testing to find values of b which fitted.
Many thanks to Sue Liu who is in S6 at Madras College in St Andrews for the followingbeautifully neat solution.
To find all 3-digit numbers $abc$ (in base $10$) such that
$$ a + b^2 + c^3 = 100a + 10b + c $$ Rearranging gives $$c^3 - c - 99a = b (10 - b)$$ $$c(c+1)(c-1) - 99a = b (10 - b)$$
For any three consecutive integers one of them is divisible by
$3$. Since $3$ divides $99$ it follows that $3$ divides $b(10-b)$.
Since $3$ is a prime this limits the possible choices of $b$:
Either
$b=0 10-b=10$ | $b(10-b) = 0$ | |
$b=3 10-b=7$ | or $b=7 10-b=3$ | $b(10-b) = 21$ |
$b=6 10-b=4$ | or $b=4 10-b=6$ | $b(10-b) = 24$ |
$b=9 10-b=1$ | or $b=1 10-b=9$ | $b(10-b) = 9$ |
Hence the possible values of $b(10-b)$ are $0$, $9$, $21$ and $24$.
We now have to find a multiple of $99$ which when subtracted
from a product of $3$ consecutive natural numbers gives $0$, $9$,
$21$ or $24$.
Since $a$ is at least $1$ $c(c+1)(c-1)$ is at least $99$ so $c$ is
at least $5$.
$c$ | $c(c+1)(c-1)$ | $a$ | $99a$ | $c(c+1)(c-1)-99a$ |
---|---|---|---|---|
$5$ | $120$ | $1$ | $99$ | $21$ |
$6$ | $210$ | $2$ | $198$ |
$12$
|
$7$ | $336$ | $3$ | $297$ | $39$ |
$8$ | $504$ | $5$ | $495$ | $9$ |
$9$ | $720$ | $7$ | $693$ | $27$ |
(Since $0$, $9$, $21$, $24 < 99$ only the multiple of $99$ which is closest to $(c+1)c(c-1)$ needs to be checked.)
From the table we can see that the following are the possibilities for $a$, $b$ and $c$:
-
$a=1$ $b=3$ or $b=7$ $c=5$
-
$a=5$ $b=1$ or $b=9$ $c=8$
giving the solutions $135$, $175$, $518$ and $598$.
Teachers' Resources
Why do this problem?
To beat the spies at their own game!
It gives practice in working systematically to consider all cases. First however you need to cut down the number of cases to be checked, so think about the relation between $a$, $b$ and $c$ and what you can deduce from it about the constraints on $a$, $b$ and $c$.
Possible approach
Ask the learners to find a relation between $a$, $b$ and $c$. Then have a class discussion about what can be deduced from this expression.
Key question
What do you know about $c^3-1$?