Why is a binary number $z=b_n\dots b_1b_0$ divisible by $3$ iff the amount of $1$'s on the even position $b_{2n}$ minus the amount of $1$'s on odd positions $b_{2n+1}$is divisible by $3$?
So meaning $11000_b$ $(=24)$ is divisible by 3 because we have one $1$ on even and one $1$ on odd Position and $1-1=0$ is divisible by $3$.
$101_b$ $(=5)$is not divisible. Because $2-0=2$ is not divisible by $3$. What is the mathematical explanation?
Even powers of $2$ are congruent to $1$ modulo $3$. Odd powers of $2$ are congruent to $2$ modulo $3$.* So suppose that in the binary representation of some number $k$, there are $m$ $1$'s in the even positions, and $n$ $1$'s in the odd positions. Then,
\begin{align} k & \equiv m+2n \mod 3 \\ & \equiv m+2n-3n \mod 3 \\ & \equiv m-n \mod 3 \end{align}
Therefore, in order for $k$ to be congruent to $0$ modulo $3$ (that is, divisible by $3$), $m$ and $n$ must be congruent modulo $3$. In other words, $m$ and $n$ must differ by a multiple of $3$.
*There are a few ways to see this. One of the simplest is induction: Observe that $2^0 = 1$ and $2^1 = 2$, then
\begin{align} 2^{r+2} & = 4 \times 2^r \\ & = 2^r + 3 \times 2^r \\ & \equiv 2^r \mod 3 \end{align}