I came back to work on this problem after a long time and after a couple of days I still cannot go better. Still TLE.
The core of my code is
def do_job2(numeros, b):
[code]
len_numeros = len(numeros)
lens_1 = len_numeros -1
indexes = [True] * len_numeros
i = -1
bigcahoona = int(b ** 0.5)
ip = 0
p = primes[ip]
while( p < bigcahoona ):
for n in numeros:
i += 1
if n:
if n is p:
indexes[i+p::p] = [0] * (((lens_1) - (i+p)) // p + 1)
break
if n % p == 0:
indexes[i::p] = [0] * (((lens_1) - i) // p + 1)
break
ip += 1
i = -1
p = primes[ip]
return [numeros[x] for x in xrange(len_numeros) if indexes[x] ][/code]
where numeros is a list with odd numbers of the range to be tested .
I' m trying to turn better the lookup for the first number multiple of the prime(p) - the for loop.
Could anyone give me a hint to speedup the code?
Thanks in advance.