- galois.totatives(n: int) list[int]
Returns the positive integers (totatives) in
that are coprime to .The totatives of
form the multiplicative group .See also
References¶
Section 2.4.3 from https://cacr.uwaterloo.ca/hac/about/chap2.pdf
Examples¶
Find the totatives that are coprime with
.In [1]: n = 20 In [2]: x = galois.totatives(n); x Out[2]: [1, 3, 7, 9, 11, 13, 17, 19]
The number of totatives of
is .In [3]: phi = galois.euler_phi(n); phi Out[3]: 8 In [4]: len(x) == phi Out[4]: True