Math NT Fermet’s Little Theorem If p is a prime integer: ap−1≡1modpap≡amodp ap−1≡1modpap≡amodp Proof Let p be a prime integer. Say a necklace has p beads and a possible colors per bread. Except for a necklace with only one color, each combination of necklace colors has p permutations. Therefore: ap≡amodp