def _trial(factors, n, candidates, verbose=False):
 if verbose:
  factors0 = list(factors.keys())
 nfactors = len(factors)
 for d in candidates:
  if ((n % d) == 0):
   m = multiplicity(d, n)
   n //= (d ** m)
   factors[d] = m
 if verbose:
  for k in sorted(set(factors).difference(set(factors0))):
   print((factor_msg % (k, factors[k])))
 return (int(n), (len(factors) != nfactors))

def _trial ( factors , n , candidates , verbose = False ) : if verbose : factors0 = list ( factors . keys ( ) ) nfactors = len ( factors ) for d in candidates : if ( ( n % d ) == 0 ) : m = multiplicity ( d , n ) n //= ( d ** m ) factors [ d ] = m if verbose : for k in sorted ( set ( factors ) . difference ( set ( factors0 ) ) ) : print ( ( factor_msg % ( k , factors [ k ] ) ) ) return ( int ( n ) , ( len ( factors ) != nfactors ) )
helper function for integer factorization .