def _check_termination(factors, n, limitp1, use_trial, use_rho, use_pm1, verbose):
 if verbose:
  print('Check for termination')
 p = perfect_power(n, factor=False)
 if (p is not False):
  (base, exp) = p
  if limitp1:
   limit = (limitp1 - 1)
  else:
   limit = limitp1
  facs = factorint(base, limit, use_trial, use_rho, use_pm1, verbose=False)
  for (b, e) in facs.items():
   if verbose:
    print((factor_msg % (b, e)))
   factors[b] = (exp * e)
  raise StopIteration
 if isprime(n):
  factors[int(n)] = 1
  raise StopIteration
 if (n == 1):
  raise StopIteration

def _check_termination ( factors , n , limitp1 , use_trial , use_rho , use_pm1 , verbose ) : if verbose : print ( 'Check for termination' ) p = perfect_power ( n , factor = False ) if ( p is not False ) : ( base , exp ) = p if limitp1 : limit = ( limitp1 - 1 ) else : limit = limitp1 facs = factorint ( base , limit , use_trial , use_rho , use_pm1 , verbose = False ) for ( b , e ) in facs . items ( ) : if verbose : print ( ( factor_msg % ( b , e ) ) ) factors [ b ] = ( exp * e ) raise StopIteration if isprime ( n ) : factors [ int ( n ) ] = 1 raise StopIteration if ( n == 1 ) : raise StopIteration
helper function for integer factorization .