galois.is_square_free

galois.is_square_free(value)

Determines if an integer or polynomial is square-free.

Parameters
value : int or galois.Poly

An integer \(n\) or polynomial \(f(x)\).

Returns

True if the integer or polynomial is square-free.

Return type

bool

Notes

A square-free integer \(n\) is divisible by no perfect squares. As a consequence, the prime factorization of a square-free integer \(n\) is

\[n = \prod_{i=1}^{k} p_i^{e_i} = \prod_{i=1}^{k} p_i .\]

A square-free polynomial \(f(x)\) has no irreducible factors with multiplicity greater than one. Therefore, its canonical factorization is

\[f(x) = \prod_{i=1}^{k} g_i(x)^{e_i} = \prod_{i=1}^{k} g_i(x) .\]

Examples

Determine if integers are square-free.

In [1]: galois.is_square_free(10)
Out[1]: True

In [2]: galois.is_square_free(18)
Out[2]: False

Generate irreducible polynomials over \(\mathrm{GF}(3)\).

In [3]: GF = galois.GF(3)

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

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

Determine if composite polynomials are square-free over \(\mathrm{GF}(3)\).

In [6]: galois.is_square_free(g3 * g4)
Out[6]: True

In [7]: galois.is_square_free(g3**2 * g4)
Out[7]: False

Last update: Apr 03, 2022