# Solve for three distinct digits A,B,C - no programming please

$A$, $B$ and $C$ are three distinct digits between 1 and 9 (not 0).

What are they if:

1. $A + B^2 + C^3 = ABC$ (need three solutions)
2. $A + B^2 + C^3 = BAC$ (one solution)
3. $A + B^2 + C^3 = ACB$ (one solution)
• PLEASE DON'T SHOUT. – Rand al'Thor Feb 19 '17 at 23:53
• This seems like exactly the sort of question that writing a program is the right way to solve. – Gareth McCaughan Feb 19 '17 at 23:55
• Did you find this puzzle somewhere else, or did you make it up yourself? If you found it, please edit to include a link to your source. – Rand al'Thor Feb 19 '17 at 23:59
• There are actually four solutions to A+B²+C³ = ABC, but I'm afraid I used a computer to find them... – r3mainer Feb 20 '17 at 0:50
• I found this myself. But puzzles like these are out there I am sure. There is logic one can use to narrow the choices down – DrD Feb 20 '17 at 1:20

1.

A = 1, B = 3, C = 5 -> 135
A = 1, B = 7, C = 5 -> 175
A = 5, B = 1, C = 8 -> 518
A = 5, B = 9, C = 8 -> 598

By simple math, we can assume right away that C cannot be 1,2,3,4 and that A cannot be 8 or 9.
We know that the number must end in C so lets find combinations that do so.
C = 5 -> 125
C = 6 -> 216
C = 7 -> 343
C = 8 -> 512
C = 9 -> 729
Note : A cannot be 6 either.
125 + 0 = XX5
216 + 0 = XX6
343 + 4 = XX7
512 + 6 = XX8
729 + 0 = XX9
The probability that A+B must end in 0 is pretty high so lets start with that.
A = 1, B = 1 -> 2
A = 1, B = 2 -> 5
A = 1, B = 3 -> 10
A = 1, B = 4 -> 17
A = 1, B = 5 -> 26
A = 1, B = 6 -> 37
A = 1, B = 7 -> 50
A = 1, B = 8 -> 65
A = 1, B = 9 -> 82
From the list up there, we can just do +1 on each of them to find the result for every possible A so...
A = 1, B = 3 -> 10
A = 4, B = 6 -> 40
These are the only 2 combinations that can end in 0 and use allowed numbers. Lets try combining it with C = 5,6 and 9.
A = 1, B = 3, C = 5 -> 135 (Yay! got 1!)
A = 1, B = 3, C = 6 -> 226
A = 1, B = 3, C = 9 -> 739
A = 1, B = 7, C = 5 -> 175 (Yay! another 1!)
A = 1, B = 7, C = 6 -> 266
A = 1, B = 7, C = 9 -> 779
A = 4, B = 6, C = 5 -> 165
A = 4, B = 6, C = 6 -> 6 is not distinct
A = 4, B = 6, C = 9 -> 769

Next are combinations ending in 4
A = 3, B = 1 -> 4
A = 5, B = 3 -> 14
A = 8, B = 4 -> 24
A = 9, B = 5 -> 34
A = 8, B = 6 -> 44
A = 5, B = 7 -> 54
A = 3, B = 9 -> 84
Now we try those for C = 7.
A = 3, B = 1, C = 7 -> 347
A = 5, B = 3, C = 7 -> 357
A = 8, B = 4, C = 7 -> 367
A = 9, B = 5, C = 7 -> 377
A = 8, B = 6, C = 7 -> 387
A = 5, B = 7, C = 7 -> 7 is not distinct
A = 3, B = 9, C = 7 -> 427

Next are combinations ending in 6
A = 5, B = 1 -> 6
A = 7, B = 3 -> 16
A = 1, B = 5 -> 26
A = 5, B = 9 -> 86
Now we try those for C = 8.
A = 5, B = 1, C = 8 -> 518 (Yay another 1!)
A = 7, B = 3, C = 8 -> 528
A = 1, B = 5, C = 8 -> 538
A = 5, B = 9, C = 8 -> 598 (Yay another 1!)

2.

Since the second one also ends by C, the previous data can all be reused.
By looking carefully at my attempts for numbers ending in 4, I found this solution.
A = 5, B = 3, C = 7 -> 357

3.

A = 2, C = 6, B = 7 -> 267
By simple math, we can assume right away that C cannot be 1,2,3,4 and that A cannot be 6, 8 or 9(same as before).
We know that the number must end in B so lets find combinations that do so.
B = 1 -> 1
B = 2 -> 4
B = 3 -> 9
B = 4 -> 16
B = 5 -> 25
B = 6 -> 36
B = 7 -> 49
B = 8 -> 64

1 + 0 = XX1
4 + 8 = XX2
9 + 4 = XX3
16 + 8 = XX4
25 + 0 = XX5
36 + 0 = XX6
49 + 8 = XX7
64 + 4 = XX8
81 + 8 = XX9

The probability that a number that ends in 8 is the correct answer is the most likely, so lets start with that.
List of AC combinations that adds up to 8.
A = 1, C = 5 -> 126
A = 1, C = 6 -> 217
A = 1, C = 7 -> 344
A = 1, C = 8 -> 513
A = 1, C = 9 -> 730
From the list up there, we can just do +1 on each of them to find the result for every possible A so...
A = 3, C = 5 -> 128
A = 2, C = 6 -> 218
A = 5, C = 7 -> 348
A = 6, C = 8 -> 518

Now we try those for B = 2, 4, 7 or 9.
A = 3, C = 5, B = 2 -> 132
A = 3, C = 5, B = 4 -> 144
A = 3, C = 5, B = 7 -> 177
A = 3, C = 5, B = 9 -> 209

A = 2, C = 6, B = 2 -> 222
A = 2, C = 6, B = 4 -> 234
A = 2, C = 6, B = 7 -> 267 (Found you!!!)
A = 2, C = 6, B = 9 -> 299

• Wow. Kudos Stack Reader. Did you get 267 also? – DrD Feb 20 '17 at 14:30
• @DeepakMahulikar No, since it doesn't end in C, I would have had to redo a lot of the math but I had no more time. – stack reader Feb 20 '17 at 15:55
• @DeepakMahulikar Ok, I just finished it. – stack reader Feb 21 '17 at 1:54

1. $A+B^2+C^3=ABC$
• $135$
• $175$
• $518$
• $598$
2. $A+B^2+C^3=BAC$
• $357$
3. $A+B^2+C^3=ACB$
• $267$

Alas, I did this by hand, brute force.  (So, the secret is out — I have no life.)  But it was guided brute force.

I constructed these tables:
\begin{array}{c|ccccccccc c|cccccccc}n^2&1^2&2^2&3^2&4^2&5^2&6^2&7^2&8^2&9^2&\quad n^3&1^3&2^3&3^3&4^3&5^3&6^3&7^3&8^3&9^3\\+&1&4&9&16&25&36&49&64&81&\quad+&1&8&27&64&125&216&343&512&729\\\hline1&*&5&10&17&26&37&50&65&82&\quad&*&9&28&65&126&217&344&513&730\\2&3&*&11&18&27&38&51&66&83&\quad&3&*&29&66&127&218&345&514&731\\3&4&7&*&19&28&39&52&67&84&\quad&4&11&*&67&128&219&346&515&732\\4&5&8&13&*&29&40&53&68&85&\quad&5&12&31&*&129&220&347&516&733\\5&6&9&14&21&*&41&54&69&86&\quad&6&13&32&69&*&221&348&517&734\\6&7&10&15&22&31&*&55&70&87&\quad&7&14&33&70&131&*&349&518&735\\7&8&11&16&23&32&43&*&71&88&\quad&8&15&34&71&132&223&*&519&736\\8&9&12&17&24&33&44&57&*&89&\quad&9&16&35&72&133&224&351&*&737\\9&10&13&18&25&34&45&58&73&*&\quad&10&17&36&73&134&225&352&521&*\end{array} Then, to solve $A+B^2+C^3=ABC$, I looked at each possible value of $C$ (the least significant digit of $ABC$).  If $C=1$, $4$, $5$, $6$ or $9$, then $C^3 \equiv C \pmod {10}$, so I needed to look only at $A$ and $B$ values where $A+B^2\equiv 0\pmod {10}$.  Similarly, if $C=2$ or $7$, then $C^3 \equiv C-4\pmod {10}$, and I needed to look only at $A$ and $B$ values where $A+B^2\equiv 4\pmod {10}$. That left only a few dozen combinations to look at, rather than $504~~(9\times 8\times7)$.

• Great. But logically you can eliminate a few numbers quickly (see answers by Stack reader) – DrD Feb 20 '17 at 14:33