import std.stdio; void main() { size_t count; bool[8191] flags; writeln("10 iterations"); // using iter as a throwaway variable foreach (iter; 1 .. 11) { count = 0; flags[] = 1; foreach (index, flag; flags) { if (flag) { size_t prime = index + index + 3; size_t k = index + prime; while (k < flags.length) { flags[k] = 0; k += prime; } count += 1; } } } writefln("%d primes", &count); }
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 1 07:15:23 PDT 2017
On Tuesday, 1 August 2017 at 14:08:26 UTC, enter per ner wrote:
> whats the mistake
wrong forum.
this is for d. learn.
Also you posted the text in the title.
More information about the Digitalmars-d
mailing list