in reply to Re^3: Number functions I have lying around
in thread Number functions I have lying around

johngg, would you please explain what you are doing with vec. I read the doc on it and got lost in the first sentence. I don't know how you are using bit vectors (this is the first time I've ever heard of them). Everything between my $sqrtLimit = sqrt $limit; to return @primes; is a big mystery to me.

You are also not eliminating numbers which end with 2, 4, 5, 6, 8, and 0 right off the bat, why?

Thanks for stopping by.

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^5: Number functions I have lying around
by atcroft (Abbot) on Mar 31, 2015 at 19:59 UTC

    Lady_Aleena, the Sieve of Eratosthenes is a well-known approach to generating primes. To illustrate, suppose you want to generate the primes between 2 and 20 (as neither 0 and 1 are prime, by definition).

    Hope that helps.

    Update: 2015-04-01
    Updated formatting of example lines to highlight overstrike of values.