It’s time for our second proof of Fermat’s Little Theorem, this time using a proof by necklaces. As you know, proof by necklaces is a very standard technique for… wait, what do you mean, you’ve never heard of proof by necklaces?! Honestly, what do they teach in schools these days…?
…just kidding! I’ll explain what necklaces are in a minute. But first, let me state that we will be proving statement (3) of FlT, namely,
If is prime and is any integer, then .
Subtracting from both sides, this is the same as saying that , which is in turn the same as saying that is evenly divisible by . As we have already seen, this statement is equivalent to the other statements (1) and (2) of Fermat’s Little Theorem.
Now, this is a necklace:
That is, a necklace is a circular arrangement of colored beads. (I’ve also labelled each bead with a number corresponding to its color, to make it easier to distinguish them.) Two necklaces are the same if they are rotations of each other. For example, these three necklaces, although they are drawn differently, are all the same:
Unlike in real life, though, we’re not allowed to flip necklaces over,^{1} so these two necklaces are different:
Now, suppose we have different bead colors to choose from. Assume that we have a plentiful supply of each bead color, so we can use as many beads of each color as we want. Here is the central question we will consider:
How many necklaces are there with exactly beads and at least two different colors?
We will show that there are in fact such necklaces—and since the number of necklaces is obviously an integer, this means that must evenly divide . So, on with the proof!
If you cut a necklace in between two beads and open it up, you get a strand (also commonly called a string or a word). Like this:
Let’s start by counting strands. First, the number of different strands with beads chosen from possible colors is : for each one of the beads we can independently choose any one of the available colors, for a total of choices. For example, if and , here are the different possible strands with beads and (up to) two colors:
Notice that we don’t have to use all the colors in each strand. is the number of available colors, but just because a color is available doesn’t mean we have to use it. As another example, here are the strands with three beads chosen from among three available colors:
Now, some of these strands use only a single color, that is, all their beads are the same color. In fact, there are exactly such strands, one for each color. So the number of strands with at least two different colors is : the total number of strands minus the strands with only one color.
So, how many necklaces are there? Let’s work backwards: think about starting with a necklace and cutting it at various points to create different strands. For example, if we start with the necklace shown below and cut it in all five possible locations, we get five distinct strands:
You can check that these five strands are all different. However, this is not always the case. For example, cutting the necklace shown below yields only three different strands:
I’ve drawn six strands above, representing all six possible cuts, but as you can see, they are not all unique—in fact, there are two copies of each strand.
What’s the difference? Well, the difference is that is prime whereas is not! Remember that we assumed , the length of our necklaces, is prime. And I claim that every necklace of prime size , that uses two or more colors, yields exactly distinct strands when cut.
Why is that? Think about what it means if a necklace yields the same strand when cut in two different places which are spaced beads apart. (In the example shown above, .) Since the strands are the same, the beads right after each cut must be the same; the beads two places after each cut must be the same, the beads three places after each cut must be the same, and so on—in general, if you look at any two beads spaced apart, they must be the same. But this means that the whole necklace has a period of —that is, the necklace consists of a group of beads which is repeated some number of times. But if the whole necklace is made up of some number of repetitions of a group of beads, that means must evenly divide the size of the necklace . But if is prime, the only way for this to happen is if , in which case the necklace consists of a single repeated bead, that is, the necklace only has one color.
So, when is prime, each necklace with at least two bead colors corresponds to exactly different strands—and each strand corresponds to exactly one necklace (the one you get when you glue the ends of the strand together). For example, here is the correspondence between the different necklaces of size with at least two colors chosen out of , and the different strands containing both colors. Each necklace corresponds to exactly different strands.
We already know there are strands with at least two colors; since we can put them in groups of , one for each necklace of at least two colors, must be evenly divisible by . QED!

Circular arrangements of beads which are considered the same up to rotations and flips are usually called bracelets.↩
Nice proof. Haven’t seen it before.
Neat!
Pingback: The Necklace proof – The nth Root
Pingback: Orthogon equivalence and orthogonal vertex sequences  The Math Less Traveled