Blog

Fermat's Little Theorem

August 2, 2024
Mathematics
Combinatorics

This is an oldie, but a cute little trick to solving Fermat’s Little Theorem that I came across back when I was an undergraduate. This is a well known proof and can be found in Wikipedia1, although I found this proof in an article posted by Fermat’s Library 2.

Theorem  (Fermat's Little Theorem)
If pp is a prime number and pnp \nmid n for nNn \in \mathbb{N}, then npnmod  pn^p \equiv n \mod p.
Proof

Let’s say that you want to make as many distinct types of necklaces as you can with pp (colourless) beads at your disposal, and where you can colour each bead with nn different colours. Assume also you only want to make multi-coloured necklaces, and that pp is prime.

...