1. The problem of forming a necklace in which no two adjacent beads have the same colour was found, unexpectedly, to lead to the little Fermat theorem and to a companion congruence with a composite modulus.
Let there be N + 1 different bead-colours. Then there are N + 1 choices of colour for the first bead to go on the string, and for each bead thereafter there are N choices. Hence for n beads the number of arrangements is (N + 1) Nn-1 But if the nth bead is the last to go on, it must have a different colour from the first.