Write code.

Finding prime factors of x

In a previous post, we showed how any number can be written, in a unique way, as the product of prime numbers.

In this post we will make a simple algorithm to compute this prime numbers.

 1 def get_primes(x):
2     non_primes = set()
3     primes = set()
4     for i in range(2, x+1):
5         if x%i == 0 and i not in non_primes:
11     return primes