TITLE: Can the magician guess the number?
QUESTION [9 upvotes]: In a parlor game, the magician asks one of the participants to think of a three digit number (abc) where a, b, and c represent digits in base 10 in the order indicated. The magician then asks this person to form the numbers $(acb)$, $(bca)$, $(bac)$, $(cab)$, and $(cba)$, to add these five numbers, and to reveal their sum, $N$. If told the value of $N$, the magician can identify the original number, $(abc)$.

This is an excerpt from the 1986 AIME (problem 10), in which $N = 3194$. But can the magician actually guess the number, for any $N$? How?
(I'd prefer an answer that allows for $a = 0$, i.e. replace "three digit number" with any number between $0$ and $999$. But the problem as stated, with $a \ge 1$, is fine too.)

One idea:
We can prove that the original 3-digit number is determined modulo $666$.
To see this, if $m = 100a + 10b + c$ is the original number,
then $N = 222(a+b+c) - m$.
Modulo $222$, this gives us $m \equiv -N$.
And modulo $9$, $m \equiv a+b+c$, therefore $N \equiv 222m - m$, and solving we get $m \equiv 2N$.
Since $m$ is determined mod $9$ and mod $222$, it is determined mod $\text{lcm}(9,222) = 666$.
Specifically, $m \equiv 443N \pmod{666}$.
But this doesn't quite solve the problem, because $666 < 1000$.

REPLY [3 votes]: $acb + bca + bac+cab + cba = 222(a+b+c) - abc$
This number is unique to $a,b,c$ because:
Suppose $222(a + b + c) - abc = 222(d+e+f) - def$ and wolog $abc \ge def$.
then $abc - def = 222([a+b+c] - [d+e+f])$.  As $abc - def < 1000$, $[a+b+c]-[d+e+f] = k$ where $k = 0,1,2,3,4$.
$abc = 100a + 10b + c \equiv a + b + c \mod 9$
and
$def \equiv d+e+f \mod 9$
So $222k = abc - def \equiv  [a+b+c]-[d+e+f] = k \mod 9$.
And therefore $221k \equiv 0 \mod 9$
so $5k \equiv 0 \mod 9$.
Of $k = 0,1,2,3,4$, $k = 0$ is the only possibility.
So $k = (a+b+c) - (d+e+f) = 0$
and $abc - def = 222*0 =0$ so $abc - def$.
====
FWIW I figured out how a magician can do this in his head quickly.
Take the result M.  Iterate and add the digits to get a single digit.  Double that and iterate to get a single digit $k$.  Multiply by $2$ and then by $111$ -- (if $2k = 1b$ this is just $1.(b+1).(b+1).b$--  Easy to do in your head) --- to get $J = 222k$.
If $J < M$ add $1998$ (add $2000$ and subtract $2$) until you get $J \ge M$. 
Then the original number is $J - M$.
Example: Result is $3194$.  Add the digits to get $8 \mod 9$.  Double to get $16 \equiv 7 \mod 9$. Multiply by $2$ to get $14$ and multiple by $111$ to get $1554$.  Add $2000 - 2$ so get $3552$.  Subtract $3194$ to get $358$ which is the original number.