galois.lcm¶
- galois.lcm(*values: int) int ¶
- galois.lcm(*values: Poly) Poly
Computes the least common multiple of the arguments.
- Parameters
- *values
Each argument must be an integer or polynomial.
- Returns
The least common multiple of the arguments.
Examples
Compute the LCM of three integers.
In [1]: galois.lcm(2, 4, 14) Out[1]: 28
Generate irreducible polynomials over \(\mathrm{GF}(7)\).
In [2]: GF = galois.GF(7) In [3]: f1 = galois.irreducible_poly(7, 1); f1 Out[3]: Poly(x, GF(7)) In [4]: f2 = galois.irreducible_poly(7, 2); f2 Out[4]: Poly(x^2 + 1, GF(7)) In [5]: f3 = galois.irreducible_poly(7, 3); f3 Out[5]: Poly(x^3 + 2, GF(7))
Compute the LCM of three polynomials \(f_1(x)^2 f_2(x)\), \(f_1(x) f_3(x)\), and \(f_2(x) f_3(x)\), which is \(f_1(x)^2 f_2(x) f_3(x)\).
In [6]: galois.lcm(f1**2 * f2, f1 * f3, f2 * f3) Out[6]: Poly(x^7 + x^5 + 2x^4 + 2x^2, GF(7)) In [7]: f1**2 * f2 * f3 Out[7]: Poly(x^7 + x^5 + 2x^4 + 2x^2, GF(7))
Last update:
May 16, 2022