You are given all the prime factors of a number, along with their multiplicities (highest powers).
The requirment is to produce all the factors of that number.
Let me give an example:
Prime factors:
- 2 (power: 3)
- 3 (power: 1)
(meaning the number is 2^3 * 3^1 = 24
)
The expected result is:
1, 2, 3, 4, 6, 8, 12, 24
I'm thinking of doing this (in C#) with some chained custom iterators, one for each prime factor, that would count from 0 to the power of that prime number.
How would you implement this? Use your preferred language.
This is related to problem #23 from Project Euler