If I was given the prime factorization of a number in the form [2, 2, 3, 5, 5]
how would I be able to find all of the factors in the form [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 25, 30, 50, 60, 75, 100, 150, 300]
I've attempted to do this through iterated loops, but as far as I was able to figure it out, it isn't clicking on a way to get the numbers as a result more than two numbers multiplying together
def find_factors(pfacts):
pfacts = [1] + pfacts
temp = []
for i in pfacts:
for j in pfacts[i+1:]:
if i * j not in temp:
temp.append(i * j)
return [1] + temp
I know this isn't the right way to do it because it only finds a small number of the factors
[1, 2, 3, 5, 6, 10, 15]