radoan1202's blog

By radoan1202, history, 5 hours ago, In English

void prime() { cs[0] = cs[1] = 1;

for (int i = 4; i < n; i += 2) cs[i] = 1;

for (int i = 3; i * i <= n; i += 2)
{
    if (cs[i] == 1)continue;

    for (int j = i * i; j <= n; j += (i + i))
       cs[j] = 1;
}

}

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it