[Verse 1]
Gather numbers zero through n minus one
Wrap them in brackets, the journey's begun
Residue classes dancing in a ring
Z mod n Z, let the mathematics sing
Addition and multiplication, both play by the rule
Modular arithmetic becomes our tool
[Chorus]
When n is prime, it's a field so bright
Every non-zero element has inverse in sight
Extended Euclidean finds the key
Z mod n Z unlocks mystery
Ring or field, the structure's clear
Prime makes inverses appear
[Verse 2]
Take twelve o'clock, we're counting mod twelve
Zero through eleven on arithmetic's shelf
Add seven plus eight, get fifteen but wait
Subtract twelve, we land on three, that's our fate
Multiplication follows the same divine law
Reduce by n, that's what we saw
[Chorus]
When n is prime, it's a field so bright
Every non-zero element has inverse in sight
Extended Euclidean finds the key
Z mod n Z unlocks mystery
Ring or field, the structure's clear
Prime makes inverses appear
[Bridge]
Composite numbers make just a ring
Divisors of zero, no inverse they bring
But when n equals seven or thirteen or five
Every element's inverse comes alive
The structure transforms from ring to field
Prime numbers make the magic real
[Verse 3]
Equivalence classes, congruent and true
If a minus b divides by n through
Brackets hold families of infinite size
But finite representatives, that's the prize
Closure and identity, the axioms hold
Ring theory's beauty starts to unfold
[Chorus]
When n is prime, it's a field so bright
Every non-zero element has inverse in sight
Extended Euclidean finds the key
Z mod n Z unlocks mystery
Ring or field, the structure's clear
Prime makes inverses appear
[Outro]
From integers infinite to finite domain
Modular magic breaks the chain
Z mod n Z, foundations strong
Abstract algebra's eternal song