Thread overview
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); }
Aug 01, 2017
enter per ner
Aug 01, 2017
Stefan Koch
Aug 01, 2017
Anonymouse
Aug 01, 2017
Stefan Koch
August 01, 2017
whats the mistake
August 01, 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.

August 01, 2017
On Tuesday, 1 August 2017 at 14:08:26 UTC, enter per ner wrote:
> whats the mistake

For everyone's sanity: https://run.dlang.io/is/bjlaNy
August 01, 2017
On Tuesday, 1 August 2017 at 14:08:26 UTC, enter per ner wrote:
> whats the mistake

you are passing a ptr to writefln.