def dup_zz_factor_sqf(f, K):
 (cont, g) = dup_primitive(f, K)
 n = dup_degree(g)
 if (dup_LC(g, K) < 0):
  (cont, g) = ((- cont), dup_neg(g, K))
 if (n <= 0):
  return (cont, [])
 elif (n == 1):
  return (cont, [g])
 if query('USE_IRREDUCIBLE_IN_FACTOR'):
  if dup_zz_irreducible_p(g, K):
   return (cont, [g])
 factors = None
 if query('USE_CYCLOTOMIC_FACTOR'):
  factors = dup_zz_cyclotomic_factor(g, K)
 if (factors is None):
  factors = dup_zz_zassenhaus(g, K)
 return (cont, _sort_factors(factors, multiple=False))

def dup_zz_factor_sqf ( f , K ) : ( cont , g ) = dup_primitive ( f , K ) n = dup_degree ( g ) if ( dup_LC ( g , K ) < 0 ) : ( cont , g ) = ( ( - cont ) , dup_neg ( g , K ) ) if ( n <= 0 ) : return ( cont , [ ] ) elif ( n == 1 ) : return ( cont , [ g ] ) if query ( 'USE_IRREDUCIBLE_IN_FACTOR' ) : if dup_zz_irreducible_p ( g , K ) : return ( cont , [ g ] ) factors = None if query ( 'USE_CYCLOTOMIC_FACTOR' ) : factors = dup_zz_cyclotomic_factor ( g , K ) if ( factors is None ) : factors = dup_zz_zassenhaus ( g , K ) return ( cont , _sort_factors ( factors , multiple = False ) )
factor square-free polyomials in z[x] .