Modular Arithmetic

coptic, french dembow

Listen on 93

Lyrics

[Verse 1]
Picture a clock face spinning round and round
After twelve comes one, that's the pattern found
When numbers wrap around at their limit line
That's modular arithmetic by design
Seven plus eight makes three on a clock of twelve
Fifteen becomes three when the numbers shelve

[Chorus]
Mod n means wrap around, wrap around
When you hit the ceiling, come back down
A congruent to B when their difference divides
By n so cleanly, that's where truth resides
Addition and multiplication both obey
The modular rules in their wrapping way

[Verse 2]
If A and B leave the same remainder when
You divide by n, they're congruent then
The vertical bars mean "divides evenly"
N divides A minus B perfectly
Twenty-three mod seven equals two
Sixteen mod seven gives two also, it's true

[Chorus]
Mod n means wrap around, wrap around
When you hit the ceiling, come back down
A congruent to B when their difference divides
By n so cleanly, that's where truth resides
Addition and multiplication both obey
The modular rules in their wrapping way

[Bridge]
Take each number, find its remainder first
Then add or multiply, let the pattern burst
The result will match if you compute it whole
Modular arithmetic keeps control
Fermat whispers secrets from the past
A to the P minus one equals one at last

[Verse 3]
When P is prime and A shares no factors
Fermat's Little Theorem never wavers
Raise A to the power P minus one
Modulo P gives one, the deed is done
This ancient truth powers RSA keys
Cryptography built on such mysteries

[Outro]
From infinite numbers to finite frames
Modular math transforms the games
Hash functions dancing, encryption strong
The wrapped-around world where we belong

← Power Series and Radius of Convergence | The Euclidean Algorithm →