Here’s a classic puzzle with a beautiful answer rooted in modular arithmetic:

Problem: Devise a simple rule to test if any number is divisible by 9, and prove why it works.


The Rule

A number is divisible by 9 if and only if the sum of its digits is divisible by 9.

For example:

  • 729 → 7+2+9=187 + 2 + 9 = 18, and 1818 is divisible by 9 → ✅
  • 1234 → 1+2+3+4=101 + 2 + 3 + 4 = 10, and 1010 is not divisible by 9 → ❌

But why does this work?


Step-by-Step Proof (Base 10)

Let a number NN be written in decimal as:

N=ak10k+ak110k1++a110+a0 N = a_k \cdot 10^k + a_{k-1} \cdot 10^{k-1} + \cdots + a_1 \cdot 10 + a_0

We want to analyze Nmod  9N \mod 9. Notice:

101(mod9),10n1n1(mod9) 10 \equiv 1 \pmod{9},\quad 10^n \equiv 1^n \equiv 1 \pmod{9}

So:

Nak+ak1++a1+a0(mod9) N \equiv a_k + a_{k-1} + \cdots + a_1 + a_0 \pmod{9}

That is, NN and the sum of its digits are congruent modulo 9.


Therefore:

  • Ndigit summod  9N \equiv \text{digit sum} \mod 9
  • So, N0mod  9    digit sum0mod  9N \equiv 0 \mod 9 \iff \text{digit sum} \equiv 0 \mod 9

Final Answer

A number is divisible by 9 if and only if the sum of its digits is divisible by 9.

Reference