There is a simple connection between Fermat’s Little Theorem and Circular Permutation. It can be summarized as number of ways to make an bead ring with
colors. So that none of the ring has all the beads of the same color. The number of beads has to be prime. Which mathematically boils down to
or
.
![](https://sumantmath.wordpress.com/wp-content/uploads/2020/12/screenshot-from-2020-12-31-17-40-19.png?w=1024)