def trial_division(n):
 prime_factors = []
 if (n < 2):
  return prime_factors
 for p in eratosthenes((int((n ** 0.5)) + 1)):
  if ((p * p) > n):
   break
  while ((n % p) == 0):
   prime_factors.append(p)
   n //= p
 if (n > 1):
  prime_factors.append(n)
 return prime_factors

def trial_division ( n ) : prime_factors = [ ] if ( n < 2 ) : return prime_factors for p in eratosthenes ( ( int ( ( n ** 0.5 ) ) + 1 ) ) : if ( ( p * p ) > n ) : break while ( ( n % p ) == 0 ) : prime_factors . append ( p ) n //= p if ( n > 1 ) : prime_factors . append ( n ) return prime_factors
uses trial division to find prime factors of n .