I don't think you need to sieve even.
Define P as the lowest number that contains all the factors under some number N
Define X as the first number greater than your input number M that also contains all the factors under N.
then X= (1+int(M/P))*P
("int" rounds down)
Finding the closest to M (either below or above) would just require a couple more simple steps.
It doesn't really matter what the factors of P are either. (i.e. prime factors from 2 to N, all integers from 2 to N). The same idea would hold.
Last fiddled with by grandpascorpion on 20051229 at 22:03
