where the number of prime factors is odd.
more specifically i want an array that's true when the index of the number is there, and false else.
here's what i've tried.
Code: Select all
size = 1000000
oddp = [False]*size
for i in range(2,size):
for j in range(i,size,i):
oddp[j] = not oddp[j]
logically i can see this doesn't work.
all even numbers get set to true on the first pass, then 6 gets false on the second pass, then back to true when 6 itself comes up.
but I've tried variations on this theme and can't quite seem to get it to work. (such as using i+i and only primes and such.)
open to suggestions.