We are given two integers I and j.we have to print x (I<=x<=j) such that number of divisors of x is maximum.if there are more than 1 x possible then print lowest x and also its number of divisors. Constraint:: 1<=I<=j<=10^9 jI<=10000 e.g. Input: 1 10 Output: 6 has 4 factors. My approach: 1) segmented sieve upto 10^9. 2) then brute force from I to j. Is there any better method?? This is not my homework!!!! One of the regional question from ACM ICPC Is there any better method?? asked 24 Jan '15, 14:53

Since, you haven't cleared you want uniqueness in divisors or not, also, there arises the case whether the divisors need to be prime or not. If you want only prime divisors and being unique is not required, then it can be If uniqueness is not the thing to work upon, then (nlogn) solution can work for you:
There's also one more possibility the question may be asked which I can think of, you are given many queries of Will you please provide the link to the exact question. :) answered 24 Jan '15, 18:01

Do you want uniqueness in divisors?