[Tutor] OverflowError: cannot fit 'long' into an index-sized integer

Keith Winston keithwins at gmail.com
Tue Jan 7 22:22:15 CET 2014


um, I used his code, slightly fine-tuned it, and got the solution.... in
.35 seconds (running time, not fine-tuning time ;). On my dinky old
notebook. So I'm inclined to believe it is possible... Though perhaps my
sense of what "fine-tuning" entails doesn't mesh with yours... spoiler
alert, more below.














Note that his code doesn't really (need to) create a sieve of Eratosthenes
all the way to n, but only to sqrt(n). It then tests for divisibility.
Though it is in this that some of the problems lie with the original code.
I'm happy to share my revision with anyone that wants it. It is pretty
rough, consistent with my Python (and math!) skills... it's really quite
close to his code.

-- 
Keith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140107/9eae3044/attachment.html>


More information about the Tutor mailing list