Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: Sieve of Eratosthenes Date: Wed, 30 Aug 2023 17:45:30 -0700 Organization: A noiseless patient Spider Lines: 27 Message-ID: <86v8cwt4yd.fsf@linuxsc.com> References: <86msyq5rqu.fsf@linuxsc.com> <56146f63-17d7-40cc-8c42-4f29c922a8c4n@googlegroups.com> <874jkknizq.fsf@bsb.me.uk> <861qfmyft6.fsf@linuxsc.com> <873502n61v.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: dont-email.me; posting-host="49a0c7fba7d7c0f06cea865d80b29294"; logging-data="3098900"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jUnLvIY39Y9efVy5r3tnWtOKBvSRX/Yk=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:3T3XusInddhwmJKS7M27LjwUu/0= sha1:ZpFyUzfoR4RQbVffxxQiotqZV2Y= Xref: csiph.com comp.lang.c++:91475 Ben Bacarisse writes: > Tim Rentsch writes: > >> Ben Bacarisse writes: >> >>> I wanted to try a newer algorithm, so I coded up a rather naive >>> version of Atkin & Bernstein's sieve in C. It needs some tidying >>> and I imagine a bit can be shaved off the time. >> >> Thank you for this. Would you mind posting your code? > > Hmm... It's a bit of a mess... but sure. [...] It looks quite okay. I haven't yet had time to look at it closely but I look forward to doing so. >> Also do >> you have a reference for the Atkin/Bernstein algorithm (or even >> better, code?)? > > Well, there's this: https://en.wikipedia.org/wiki/Sieve_of_Atkin Excellent! And this page has a link to DJ Bernstein's fast primes code, which is stunningly swift. Thank you for both.