I tried optimizing everything all things you guys pointed out and still its orders of magnitude away from the expected result.<div>The program should check the islucky condition between range of (1,10**18) numbers and iterate over that 10**5 times.</div>
<div>This program slows down more than 16 secs at (1,10**8) and 1 time.</div><div>Which approach should i follow?</div>