def generate_all_factorizations(factors):
    seen = set()
res = []
for f in _generate_all_factorizations(factors):
    f = tuple(sorted(f))
if f in seen:
    continue
seen.add(f)
yield f
Algorithm to find ALL factorizations of an integer