Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: Sieve of Erastosthenes optimized to the max Date: Sat, 23 Dec 2023 10:21:04 -0800 Organization: A noiseless patient Spider Lines: 9 Message-ID: <86il4ovkz3.fsf@linuxsc.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: dont-email.me; posting-host="a0e2891dc7b8f3c7cc576ac7cc01eb92"; logging-data="2290155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ryWQqyaEWken9dKLl+AmYCosc68BbGlA=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:oaYFpJqf/ydu7EsdeGkUxBQF37A= sha1:NoP2UDUBLBFl+g8H6BxYxYc2CIk= Xref: csiph.com comp.lang.c++:118118 Vir Campestris writes: > On my system my code takes about 20 seconds to produce 1e9 > primes. [...] Do you mean 1e9 primes or just the primes less than 1e9? To do the first 1e9 primes a sieve would need to go up to about 23.9e9 (so half that many bits if only odd numbers were represented).