Problem six:
Factors

Given: positive (32bit) integers N and F, where N and F are both greater than 0, and N is greater than F. Compute all factorizations of N, where the number of factors of N is F and all factors are positive. Exclude permutations. Any factor can be repeated. Examples:

input:
  10, 1
output:
  10

input:
  10, 2
output:
  1 * 10
  2 * 5

input: 
  10, 3
output:
  1 * 1 * 10
  1 * 2 * 5

Doug Lea
Last modified: Fri Oct 15 14:46:04 EDT 1999