Residue multiplication table

mulres version 0.1 (c) Brian Chandler 1993

This prints the multiplication table of the residues modulo n which are coprime to n. (In other words, multiplication round the "number circle of size n" in place of the ordinary "number line" of integers.)

The function φ(n) (also known as Euler's totient function) is defined as the number of these residues. Moreover, the residues form a group under multiplication, as you can check from the table: associativity is obvious, since multiplication in the integers is associative, multiplication is closed, since if you multiply together two numbers coprime to n, the answer must also be coprime, and um inverses are established by a bit of hand waving (the cancellation laws work, for a start).

coprime: argument must be number

coprime: argument must be positive


Group of coprime residues modulo under multiplicationn