galois.is_primitive_root¶
- galois.is_primitive_root(g, n)¶
Determines if
is a primitive root modulo .Notes
The integer
is a primitive root modulo if the totatives of , the positive integers that are coprime with , can be generated by powers of .Alternatively said,
is a primitive root modulo if and only if is a generator of the multiplicative group of integers modulo ,where
is order of the group.If
is cyclic, the number of primitive roots modulo is given by .Examples
In [1]: galois.is_primitive_root(2, 7) Out[1]: False In [2]: galois.is_primitive_root(3, 7) Out[2]: True In [3]: galois.primitive_roots(7) Out[3]: [3, 5]
Last update:
Feb 09, 2022