galois.are_coprime¶
- galois.are_coprime(*values: int) bool ¶
- galois.are_coprime(*values: Poly) bool
Determines if the arguments are pairwise coprime.
- Parameters
- *values
Each argument must be an integer or polynomial.
- Returns
True
if the arguments are pairwise coprime.
Notes
A set of integers or polynomials are pairwise coprime if their LCM is equal to their product.
Examples
Determine if a set of integers are pairwise coprime.
In [1]: galois.are_coprime(3, 4, 5) Out[1]: True In [2]: galois.are_coprime(3, 7, 9, 11) Out[2]: False
Generate irreducible polynomials over \(\mathrm{GF}(7)\).
In [3]: GF = galois.GF(7) In [4]: f1 = galois.irreducible_poly(7, 1); f1 Out[4]: Poly(x, GF(7)) In [5]: f2 = galois.irreducible_poly(7, 2); f2 Out[5]: Poly(x^2 + 1, GF(7)) In [6]: f3 = galois.irreducible_poly(7, 3); f3 Out[6]: Poly(x^3 + 2, GF(7))
Determine if combinations of the irreducible polynomials are pairwise coprime.
In [7]: galois.are_coprime(f1, f2, f3) Out[7]: True In [8]: galois.are_coprime(f1 * f2, f2, f3) Out[8]: False
Last update:
May 16, 2022