galois.totatives¶
- class galois.totatives(n)¶
Returns the positive integers (totatives) in \(1 \le k < n\) that are coprime with \(n\), i.e. \(\mathrm{gcd}(n, k) = 1\).
The totatives of \(n\) form the multiplicative group \(\mathbb{Z}{_n^\times}\).
References
Examples
In [1]: n = 20 In [2]: totatives = galois.totatives(n); totatives Out[2]: [1, 3, 7, 9, 11, 13, 17, 19] In [3]: phi = galois.euler_totient(n); phi Out[3]: 8 In [4]: len(totatives) == phi Out[4]: True