Page 2 of 2

Posted: Mon Jul 19, 2004 3:44 pm
by technobug
how do i expand it to bit-wise comparison? (c/c++)

Posted: Thu Jul 29, 2004 1:01 pm
by Pavl0
Jdont like Sieve of Eratosthenes :P

somthing like that take les memory (only prime numbers)

for(i=6;i<=2000000;i+=6)
{
for(j=0;;j++){ if((i-1)%fst[j]==0)break; if((fst[j]*fst[j])>(i-1))
{fst[liczp]=i-1; countprime++; break;}}
for(j=0;;j++){ if((i+1)%fst[j]==0)break; if((fst[j]*fst[j])>(i+1))
{fst[liczp]=i+1; countprime++; break;}}
}

check if devide by smaler prime numbers + some optimaliation
it if fast but if tou need somthing faster add fermat test

Posted: Thu May 04, 2006 9:51 pm
by serur
Seat of Eratosphenes - that's really cool!
Thank you fellows - I didn't laugh like this for a long time! :D