I tried optimizing everything all things you guys pointed out and still its
orders of magnitude away from the expected result.
The program should check the islucky condition between range of (1,10**18)
numbers and iterate over that 10**5 times.
This program slows down more than 16 secs at
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.
No,i meant sum of digits is prime and also sum of square of digits is prime.
E.g: 23 is lucky cos
2+3=5 (prime)
2**2+3**2 = 4+9 = 13 (prime)
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
I m using Python 2.7
Steven wrote:
Scale your numbers from time to time, to avoid them getting too big
What does this mean?
inp refers to the sample input test case I have given at first.Its a string
containing two numbers,
The program has to handle large numbers till 10**18 and also has to
Calculating the table is fast.
I think either my luckiness test (where i find the sum of all digits and
sum of squares of all digits of a large number)
or generating numbers is slow.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
Thank you all for helping me understand the overflow error.
I m a newbie on mailing lists.I apologize for my errors.
Program:
def sieve(maxi):
primes = range(2,maxi+1)
for i in primes:
j = 2
while i * j = primes[-1]:
if i * j in primes:
primes.remove(i*j)
j += 1
How to correct this error?
* OverflowError: Python int too large to convert to C long*
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
(Shreesh bhat)
2. Re: OverFlow Error (Alan Gauld)
3. Re: Tutor Digest, Vol 95, Issue 53 (George Nyoro)
4. Re: Tutor Digest, Vol 95, Issue 53 (Steven D'Aprano)
5. Re: delete an object from method (was Tutor Digest) (Dave Angel)
6. checking return status of 'ping' in windows (Nikunj Badjatya