In the finite field \(\mathbb{F}_7\), one third is \(5\). That sounds odd until we ask what a multiplicative inverse actually does. We want a number \(x\) such that \(3x = 1\) in the field. Since we do arithmetic modulo \(7\), this amounts to solving
Try \(x = 5\). We get \(3 \cdot 5 = 15 = 2 \cdot 7 + 1\). The remainder is exactly \(1\), so \(3^{-1} = 5\) in \(\mathbb{F}_7\).
Let the computer try all six candidates
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
The programme prints 5. Now change p to 6 and run it again.
This time it prints nothing. Modulo \(6\), the multiples of \(3\) alternate
between \(3\) and \(0\), so they never reach \(1\). That is one reason we call
\(\mathbb{F}_7\) a field: every non-zero element has a multiplicative inverse.
The integers modulo \(6\) fail that test.