factors of a number

36 Views Asked by At

I have to find exact n(any number specified) factors of a number whose all product combined yield the number and largest of n factors is minimised. Eg: n=2 for number 12; 12= 6*2,12*1,4*3,we will take 4*3 as largest of n factors is minimised here.

Rephrased:

Given $n$ and $M$, write $M$ as a product of $n$ numbers so as to minimise the largest of them.

What can be the approach to solve this problem?

My approach: break number in prime factors as 12=2*2*3,count each unique number and then distribute it among the n factors like for n=2; let the factors be a and b then as count of "2" is 2 I distribute it as one "2" to both a and b then the remaining 3 can be given to any of a and b but it will produce a=2*3 and b=3 which is wrong,can anyone provide better solution?