[Verse 1]
When numbers dance in modular space
There's a pattern hiding in this place
If gcd of a and n equals one
Then Euler's magic has begun
Raise a to the power of phi of n
And modulo n brings us back again
[Chorus]
It's a mathematical clock that's ticking
Powers cycle, never tricking
a to the phi of n mod n equals one
Euler's theorem, the pattern's won
Like Fermat's little theorem but generalized
For any modulus, the cycle's realized
[Verse 2]
Fermat showed us when n is prime
Phi of p is p minus one every time
But Euler took it further than before
Any composite number, he explored
The totient function counts the coprime friends
And shows us where the cycling ends
[Chorus]
It's a mathematical clock that's ticking
Powers cycle, never tricking
a to the phi of n mod n equals one
Euler's theorem, the pattern's won
Like Fermat's little theorem but generalized
For any modulus, the cycle's realized
[Bridge]
RSA encryption needs this law
Choose two primes without a flaw
Multiply them, call it n
Phi of n is where we begin
Public key and private key
Work together perfectly
[Verse 3]
Message m gets raised to power e
Ciphertext c is what we see
Then c to the power d brings back
The original message on the right track
Because e times d leaves remainder one
When divided by phi of n, we're done
[Chorus]
It's a mathematical clock that's ticking
Powers cycle, never tricking
a to the phi of n mod n equals one
Euler's theorem, keeps us secure
Digital secrets safe and sure
The cycle brings us home for sure
[Outro]
From Fermat's prime to Euler's grand design
Mathematical clocks keep perfect time