Hi,
I am currently working on the MiniMice problem. My strategy is to first find all primes from 1 to 5000000, then all divisors of n for 1 <= n <= 5000000, store all of these in arrays, and then proceed with finding what the question asks for.
My problem is that I can't seem to find an algorithm efficient enough to run in under 6 seconds to find all the divisors. I am finding the primes by checking to see if n is divisble by any primes up to sqrt( n ). Then I'm finding all divisors by dividing n by the same prime until it can no longer be divided by that prime. In other words using the fact that for b1^(c1)*b2^(c2)*...bn^(cn), that there are (c1+1)(c2+1)...(cn+1) divisors.
Now, either my algorithm isn't efficient, or I'm doing a lot of extra stuff that I don't need to be doing. I don't see any more efficient manner in which to find all the divisors, so it's probably that I don't need to do all of this, and there's another way.
Can anybody offer some help?
Thanks.
