Can the magician guess the number? 
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$.
 A: With the calculated value of $m\bmod666$ we evaluate possible values of $m=\overline{abc}$. If there is only one possible number ($m>333$) then we are done. Otherwise there will be two candidates $m_1=m$ and $m_2=m+666$ and we can check them easily to see whether they produce $N$ exactly.
$m_1$ and $m_2$ must produce different values of $N$. To see why, consider the addition $m_1+666$ and four cases depending on whether there is a carry-over from the units and tens places. For $N$ to remain unchanged we must have $222(\Delta a+\Delta b+\Delta c)-666=0$, or $S=\Delta a+\Delta b+\Delta c=3$.


*

*No carry: $\Delta a=\Delta b=\Delta c=6$. $S=18$.

*Carry from units place: $\Delta c=-4, \Delta b=7, \Delta a=6$. $S=9$.

*Carry from tens place: $\Delta c=6, \Delta b=-4, \Delta a=7$. $S=9$.

*Carry from both units and tens: $\Delta c=-4, \Delta b=-3, \Delta a=7$. $S=0$.


Since $S$ is not 3 in all cases, $N$ must change in going from $m_1$ to $m_2$. Hence we will always get a unique, correct value for $m$ from $m_1$, $m_2$ and $N$.
A: $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.
