[algogeeks] Re: Inscription test run problems

2006-03-27 Thread BiGYaN
With regards to the first problem, it is pretty easy if you can have all the primes precomputed. As a matter of fact, if you search the net, you'll find the list of all prime no.s that can be stored as a 4 byte unsigned integer !!. Just use that list of primes to find out the nearest with the help

[algogeeks] Re: Inscription test run problems

2006-03-25 Thread Dhyanesh
What are the limits for the problems ? Are the programming contest problems ? 1. If not too much .. precompute all primes till the limit and then you can easily find using binary search the higher and lower primes. 2.Just create a binary tree and see ? Is that too much time ? Let me know limits