Encoding of multiplicative group of integers modulo n

Definition
This article defines the standard (typical) method of encoding the multiplicative group of integers modulo n for $$n > 1$$.

The encoding is as follows. We assume that there is an encoding available for the positive integers, say, using a suitable base notation (such as binary notation). To encode an element of the multiplicative group of integers modulo n, simply use the encoding for the unique positive integer among $$1,2,3,\dots,n-1$$ that corresponds to that congruence class.

Note that the order of the group is the Euler totient function $$\varphi(n)$$ which is $$\Omega(n/\log n)$$ and $$O(n)$$. In particular, this means that $$O(\log \varphi (n)) = O(\log n)$$ and polynomials in $$n$$ also grow polynomially in $$\varphi(n)$$. It's easier to give estimates based on $$n$$, which is what we do below.

The algorithms are as follows: