How can I tell if a number in base 5 is divisible by 3?

Solution 1:

Divisibility rules generally rely on the remainders of the weights of digits having a certain regularity. The standard method for divisibility by $3$ in the decimal system works because the weights of all digits have remainder $1$ modulo $3$. The same is true for $9$. For $11$, things are only slightly more complicated: Since odd digits have remainder $1$ and even digits have remainder $-1$, you need to take the alternating sum of digits to test for divisibility by $11$.

In base $5$, we have the same situation for $3$ as we have for $11$ in base $10$: The remainder of the weights of odd digits is $1$ and that of even digits is $-1$. Thus you can check for divisibility by $3$ by taking the alternating sum of the digits.

More generally, in base $b$ the sum of digits works for the divisors of $b-1$ and the alternating sum of digits works for the divisors of $b+1$.

Solution 2:

Add the digits, but multiply the even digits by 2.

This works because $5 \equiv 2 \mod 3$, $5^2 \equiv 1 \mod 3$, etc.

Solution 3:

The $n=(d_m \cdots d_0)_5$ then $n$ is divisible by $3$ iff $d_0-d_1+d_2-d_3+\cdots$ is divisible by $3$.

This follows from $5^k \equiv 1 \bmod 3$ if $k$ is even and $5^k \equiv -1 \bmod 3$ if $k$ is odd.