<div>I have given the definition of lucky numbers and constraints involved at the starting of the thread.</div><div>when a number&#39;s sum of digits and square of sum of digits is prime,it is called lucky.</div><div><br></div>

<div>I already tried generating prime numbers using sieve of atkin algorithm rather than doing primality test.</div><div>Efficiency improved a lot but still couldnt reach 16 sec target.</div><div><br></div><div>The large numbers are the only hindrance to the speed.
</div><div>Since i m new to Python.I dont know all its recipes and tricks inlvolved to &quot;charm-the-snake&quot;.
</div><div>So can i improve the islucky method more than what i mentioned before?</div><div>Can i work around that way in python or should i come up with a new algorithm?</div>