chef and interview

can anybody explain what this question wants?

I hope you are asking for this problem

As per question for a given positive integer N, what is the maximum sum of distinct numbers such that the Least Common Multiple of all these numbers is N.

Or in other words you have to find out sum of all factors of a given number including 1 and itself.(Ask-yourself WHY?)

In order to get full 100 points you have to solve the solution in O(nk) time where k<1 You would observe this after making a simple program in O(n) time.

My Approach

Lets consider a number 20. If 2 is factor of 20, then 20/2(=10) is also a factor of 20… Similarly if 4 is a factor of 20 then 20/4(=5) is a factor of 20.

Here is mine AC solution for this question(in Java)

Hope you would have got your answer

Give a link to that question