Performance conundrum - my primes function should really be faster.

2009-03-12 Thread levand
So, I'm doing the whole Euler thing, and I'm writing a function for finding primes using wheel factorization in combination with the Sieve of Eratosthenes. The algorithm is correct, but very slow. I've managed to isolate the part that's having unexpectedly bad performance. I just can't see why

Re: Performance conundrum - my primes function should really be faster.

2009-03-12 Thread Luke VanderHart
Ok, sorry for posting this. I figured it out myself. Turns out that my eratosthenes function took much, much longer on primes and near-primes than it does on the average number. And, of course, the numbers that pass through the wheel factorization filter are just that. So the good news is that