My initial approach was very similar to yours, and it took forever to produce results. This did it in a few seconds. I multiplied all the primes in the range from 1 to 20 (2, 3, 5, 7, 11, 13, 17, 19) The idea was that the primes did not have a GCD, and the smallest number, eligible to participate must be in their product.
acnum=0.0
testnum=9699690
divisor=20.0
while acnum==0.0:
if testnum%divisor==0.0:
divisor-=1.0
print testnum, divisor
else:
testnum+=9699690
divisor=20.0
if divisor==1.0:
acnum=testnum
Of course, this is far from complete code, but it did its job.
source
share