galois.is_square_free

galois.is_square_free(value)

Determines if the positive integer or the non-constant, monic polynomial is square-free.

Parameters

value (int, galois.Poly) – A positive integer \(n\) or a non-constant, monic 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 .\]

Similarly, 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 an integer is square-free.

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

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

Determine if a polynomial is square-free 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))

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

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