whats the mistake
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); }
enter per ner via Digitalmars-d Tue, 01 Aug 2017 07:11:43 -0700
- import std.stdio; void main() { size_... enter per ner via Digitalmars-d
- Re: import std.stdio; void main() { ... Stefan Koch via Digitalmars-d
- Re: import std.stdio; void main() { ... Anonymouse via Digitalmars-d
- Re: import std.stdio; void main() { ... Stefan Koch via Digitalmars-d