Is there an algorithm to determine all distinct factorizations of a number, if both the number and its prime factorization are known?
Example
n = 64
f = 2^6
The factors are:
1, 2, 4, 8, 16, 32, 64
I am not asking for the above. Instead, is there a method to find the following:
- 1 * 64
- 2 * 32
- 2 * 2 * 16
- 2 * 2 * 2 * 8
- 2 * 2 * 2 * 2 * 4
- 2 * 2 * 2 * 2 * 2 * 2
- 4 * 16
- 4 * 2 * 8
- 4 * 4 * 4
- 8 * 8
The above example has one distinct prime factor, but I would like a solution generalized to n distinct prime factors.
You can iterate through all divisors $d$ of $n$ and then recursively list all factorizations of $n/d$ where every factor is at most $d$. If you want to know how to implement this efficiently, I can code something in c++.