Sujet : Re: OT: Re: Sieve of Erastosthenes optimized to the max
De : vir.campestris (at) *nospam* invalid.invalid (Vir Campestris)
Groupes : comp.lang.c++Date : 19. Aug 2024, 22:34:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va0a8b$30cvv$2@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
User-Agent : Mozilla Thunderbird
On 16/08/2024 18:35, Bonita Montero wrote:
But basically I don't think it is a good idea to skip numbers exept
multiples of two. With the three you save a sixth of memory, with
the five you save a 15-th and at the end you get about 20% less
storage (1 / (2 * 3) + 1 / (2 * 3 * 5) + 1 / (2 * 3 * 5 * 7) ...)
for a lot of computation. That's the point where I dropped this
idea and I think this extra computation is higher than the time
for the saved memory loads.
BTW I was just checking outputs.
66049
67591
69133
69647
71189
72217
72731
75301
78899
79927
80441
81469
85067
86609
89179
89693
90721
92263
94319
95861
97403
98431
99973
all show in the output for your program, but not mine. I think you'll find they are products of 257 and the next few primes.
Andy