TITLE: Better Divisibility by 8
QUESTION [9 upvotes]: Everywhere I look, when you want to see if something is divisible by $8$ then you see if the last $3$ digits are divisible by eight. But how do you know if the last $3$ digits are divisible by $8$? For example, I can't tell you immediately that $976$ is divisible by $8$. Is there a better algorithm for $8$-divisiblility or do I just need to get better at my arithmetic?

REPLY [2 votes]: Hint $\,\ 8\mid abc \iff ((c/2+b)/2+a)/2\,$ yields integers for all quotients,
e.g. your $\,8\mid \color{#c00}9\color{#0af}7\color{#96f}6\,$ by  $\smash[]{\underbrace{(\overbrace{(\color{#96f}6/2+\color{#0af}7)/2}^{\large =\,\color{#0af}5}+\color{#c00}9)/2}_{\large =\, \color{#c00}7}}\,$ has integer quotients $\,\color{#96f}3,\color{#0af}5,\color{#c00}7^{\phantom{I^{I^{I^{I^I}}}}}_\phantom{I^{I^{I^{I^I}}}}$
With practice the test takes only a few seconds of trivial mental arithmetic.
A proof is easy. Note $\ 8\mid c + 10 b + 10^2 a\iff 8\mid c + 2b + 2^2 a\ $ since $\,10\equiv 2\pmod 8$
Further $\,\ nd\mid c + d\, e\iff d\mid c\ \ \&\ \ n\mid c/d + e.\,$ Iterating this yields said test
Lemma $\,\ d^3\!\mid c + d\,b + d^2 a\iff ((c/d + b)/d + a)/d\,$ yields integers for all quotients. 
$\!\begin{eqnarray}{\bf Proof} && && d^{\,3}\!\mid\  c\, +\, d\,b + d^2 a\\
&\iff&\quad\ \ d\mid c &\ \&\ &d^{\,2}\!\mid\ c/d + b + d\, a\\
&\iff& \begin{array}{}\quad\ \ d\mid c\\ d\mid c/d+b\end{array}&\ \&\ &\ d\,\mid (c/d + b)/d+a\quad {\bf QED}\\\
\end{eqnarray}$