def prime_factorization(n): limit = int(n ** 0.5) prime = 2 while prime <= limit: if n % prime == 0: n = n / prime limit = int(n ** 0.5) else: prime = next_prime(prime) return n
def nth_prime(n): prime = 2 while n > 1: prime = next_prime(prime) n = n - 1 return prime