Fermat's Little Theorem

Number Theory Fundamentals · 3:43

Listen on 93

Lyrics

[Verse 1]
When p is prime and a's got no common ground
With p itself, then something magical is found
Take powers of a, raise it up to p minus one
The answer mod p is always gonna be just one

[Chorus]
Fermat's little secret, hiding in the math
A to the p minus one equals one on the path
When the prime and number share no common part
This theorem's gonna work, it's mathematical art
One mod p, one mod p, that's the key you see
Fermat's little theorem sets the numbers free

[Verse 2]
Let me show you why this magic always works so well
Take your number a and multiply through every cell
One times a, two times a, up to p minus one times a
Mod p they're just a shuffle of the numbers in our way

[Chorus]
Fermat's little secret, hiding in the math
A to the p minus one equals one on the path
When the prime and number share no common part
This theorem's gonna work, it's mathematical art
One mod p, one mod p, that's the key you see
Fermat's little theorem sets the numbers free

[Bridge]
Multiply them all together, what do you find
P minus one factorial on both sides combined
Cancel out the factorial, it's safe to do
Since the prime can't divide it, the theorem comes through

[Verse 3]
There's another way to say it, just as sweet and true
A to the power p equals a, that formula works too
For every single number, this pattern holds its ground
In modular arithmetic, this gem is what we've found

[Final Chorus]
Fermat's little secret, now you know the way
A to the p minus one mod p is one today
When gcd of a and p equals just one
This theorem's always true, the proof is done
One mod p, one mod p, mathematical decree
Fermat's little theorem, perfect harmony

← Euler's Totient Function | Euler's Theorem (Generalization) →