[Tutor] OverflowError in lucky numbers script

Shreesh bhat shreeshbhat90 at gmail.com
Mon Jan 23 19:51:04 CET 2012

I have given the definition of lucky numbers and constraints involved at
the starting of the thread.
when a number's sum of digits and square of sum of digits is prime,it is
called lucky.

I already tried generating prime numbers using sieve of atkin algorithm
rather than doing primality test.
Efficiency improved a lot but still couldnt reach 16 sec target.

The large numbers are the only hindrance to the speed.
Since i m new to Python.I dont know all its recipes and tricks inlvolved to
So can i improve the islucky method more than what i mentioned before?
Can i work around that way in python or should i come up with a new
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120124/2bb9e449/attachment.html>

More information about the Tutor mailing list