Deutsch English Français Italiano |
<v25c87$1ld9m$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Vir Campestris <vir.campestris@invalid.invalid> Newsgroups: comp.lang.c++ Subject: Re: Sieve of Erastosthenes optimized to the max Date: Thu, 16 May 2024 17:28:55 +0100 Organization: A noiseless patient Spider Lines: 45 Message-ID: <v25c87$1ld9m$1@dont-email.me> References: <ul41d4$2koct$1@raubtier-asyl.eternal-september.org> <um2dsb$17vgg$2@dont-email.me> <um2vpr$1e7pn$1@raubtier-asyl.eternal-september.org> <um31o0$1edq3$1@dont-email.me> <um4f1l$1l1c2$1@raubtier-asyl.eternal-september.org> <um7haa$274oh$3@dont-email.me> <um8vlp$2h8oc$1@raubtier-asyl.eternal-september.org> <uma7i4$2nagg$1@dont-email.me> <umdmkf$3clht$1@raubtier-asyl.eternal-september.org> <umdovb$3cmi3$2@dont-email.me> <ume6ap$3ecjk$1@raubtier-asyl.eternal-september.org> <umfcqi$3jktj$2@dont-email.me> <umgbci$3qpao$1@raubtier-asyl.eternal-september.org> <utlf3h$393l6$1@dont-email.me> <utn1fp$3oeks$2@raubtier-asyl.eternal-september.org> <utng4n$3rn1f$2@dont-email.me> <utoh9d$6lrr$1@raubtier-asyl.eternal-september.org> <utq0ag$hvrl$3@dont-email.me> <utq0os$ibqn$1@raubtier-asyl.eternal-september.org> <utq11p$icmm$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 16 May 2024 18:28:56 +0200 (CEST) Injection-Info: dont-email.me; posting-host="e247cced23bd79bee244615b2c82aa02"; logging-data="1750326"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/FfzZLm1t4DBTabscRlfHA3nQ0/4uZuKk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:f+qrgUZjUYqGFbItgS8UEKDShhc= Content-Language: en-GB In-Reply-To: <utq11p$icmm$1@dont-email.me> Bytes: 4061 I've been playing with this. Has it really been this long? I ought to have more time than this... I put together some code, and have been playing with it far too much. Bonita, I don't know whether to curse you or kiss you. (Though in fact I suspect you may be a little young for me. Possibly too young for my kids...) I haven't written any code just for fun in years. Maybe decades! I missed Tim's Mod 30 trick, and that might well help. But I think I'm bored with this. It would save a lot of memory, but the extra computation might make it slower. Maybe I'll try one day ;) My code isn't as fast as Bonita's code. Even allowing that I didn't put any threads in there. But... When I compared the output there were differences. Specifically your program claimed that these numbers 66049,67591,69133,69647,71189,72217,72731,75301,78899,79927,80441,81469,85067,86609,89179, 89693,90721,92263,94319,95861,97403,98431,99973,102029,103057,105113,107683,108197,110767, 111281,112823,113851,115393,117449,118477,118991,120019,123103,125159,126187,128243,129271, 130813,133897,134411,139037,140579,143149,144691,146233,146747,148289,150859,152401,153943, 154457,155999,157541,158569,159083,162167,164737,165251,166279,167821,169363,169877,172961, 173989,175531,177587,180157,182213,184783,186839,188381,189923,190951,193007,194549,195577, 197633,198661,202259,204829,207913,208427,210997,211511,212539,213053,215623,219221,220249, 220763,221791,225389,226417,226931,227959,233099,234127,236183,238753,240809,241837,243379, 244921,248519,249547,251089,252631,254687,256229,259313,260341,261883,262397,264967,265481, 267023,269593,270107,272677,273191,274733,279359,280387,280901,281929,283471,285013,287069, 288611,290153,295807,296321,298891,300947,303517,305059,306601,308657,311741,312769,314311, 315853 are all prime. They aren't. The first one is 257 squared, and the others all have factors too. I'd also suggest that you comment demonstration code. It's intended to show off fancy techniques, and they aren't obvious without explanation. I learned that lesson when I was a student, when I couldn't understand something I'd written myself! Andy