Page 1 of 1

12377 - Number Coding

Posted: Tue Jun 26, 2012 7:39 am
by magurmach
Some random input-output:

Input:

Code: Select all

7
1987654
31203
31230
313140
3123450
5135798
51357980
Output:

Code: Select all

9
0
504
1008
1512
15120
30240

Re: 12377 - Number Coding

Posted: Tue Jun 26, 2012 7:46 am
by magurmach
One little Spoiler:

43560=2^3×3^2×5^1×11^2 has 4 factors with frequencies 3, 2, 1 and 2, hence coded as 41223. So, if you are backtracking you have to keep in mind that you want a sequence of number such that it is in non-descending order! More clearly, for test case 31223 a valid sequence of powers may be 1 2 23 not 1 22 3