Can the magician guess the number?
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$.
$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.