We wish to show that xpx(modp)x^p \equiv x (\mod p) combinatorially . Let's take 23(mod3)2^3 (\mod 3) for simplicity. The general case follows. Let's first write down strings which enumerate 232^3:

000001010011100101110111

To make use of mod3\mod 3, we're going to treat our strings as necklaces . So, for example, the string 011 looks like:

*-→ 0 -*|      ||      ↓1 ←--- 1

So we have three possible rotations of the string 011:

011110101
Cyclic subshifts of strings:---------------------------000, 000, 000001, 010, 100011, 110, 101111, 111, 111
all strings   = {shifts of 001, 011}U{000, 111}|all strings| = |{shifts of 001, 011}|+|{000, 111}|no. of shifts = 3*(no. of representatives)2^3 = 3 * (no. of representatives) + 22^3 = 3 * (no. of representatives) + 22^3 % 3 = 2

In general, for x^p % p, we will get x strings that contain the same letter. These will not have elements in their cyclic shift equivalence classes. The other strings will be generated as the smallest cyclic subshift of some string.

§ Why does this not work when p is not prime?

Let p = 4. In this case, I can pick the string s = 0101. It has shifts:

0101 <-10100101 <-1010

so two of its shifts overlap, hence we will double-count the string 0101 if I counted its equivalence class as having size 4.

§ Relationship to group theory?

§ References