galois.lcm

galois.lcm(*values)

Computes the least common multiple of the arguments.

Parameters
*values : int or galois.Poly

Each argument must be an integer or polynomial.

Returns

The least common multiple of the arguments.

Return type

int or galois.Poly

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]: p1 = galois.irreducible_poly(7, 1); p1
Out[3]: Poly(x, GF(7))

In [4]: p2 = galois.irreducible_poly(7, 2); p2
Out[4]: Poly(x^2 + 1, GF(7))

In [5]: p3 = galois.irreducible_poly(7, 3); p3
Out[5]: Poly(x^3 + 2, GF(7))

Compute the LCM of three polynomials.

In [6]: a = p1**2 * p2; a
Out[6]: Poly(x^4 + x^2, GF(7))

In [7]: b = p1 * p3; b
Out[7]: Poly(x^4 + 2x, GF(7))

In [8]: c = p2 * p3; c
Out[8]: Poly(x^5 + x^3 + 2x^2 + 2, GF(7))

In [9]: galois.lcm(a, b, c)
Out[9]: Poly(x^7 + x^5 + 2x^4 + 2x^2, GF(7))

In [10]: p1**2 * p2 * p3
Out[10]: Poly(x^7 + x^5 + 2x^4 + 2x^2, GF(7))

Last update: Apr 03, 2022