galois.is_primitive_root¶
- class galois.is_primitive_root(g, n)¶
Determines if \(g\) is a primitive root modulo \(n\).
\(g\) is a primitive root if the totatives of \(n\), the positive integers \(1 \le a < n\) that are coprime with \(n\), can be generated by powers of \(g\).
- Parameters
- Returns
True
if \(g\) is a primitive root modulo \(n\).- Return type
Examples
In [545]: galois.is_primitive_root(2, 7) Out[545]: False In [546]: galois.is_primitive_root(3, 7) Out[546]: True In [547]: galois.primitive_roots(7) Out[547]: [3, 5]