OSDN Git Service

:bug: fix typo
authorShuhao Zhang <594422141@qq.com>
Wed, 16 Oct 2019 11:02:20 +0000 (19:02 +0800)
committerGitHub <noreply@github.com>
Wed, 16 Oct 2019 11:02:20 +0000 (19:02 +0800)
docs/math/sieve.md

index 1179175..76a538e 100644 (file)
@@ -143,7 +143,7 @@ void pre() {
 ```cpp
 void pre() {
   d[1] = 1;
-  for (int i = 1; i <= n; ++i) {
+  for (int i = 2; i <= n; ++i) {
     if (!v[i]) v[i] = 1, p[++tot] = i, d[i] = 2, num[i] = 1;
     for (int j = 1; j <= tot && i <= n / p[j]; ++j) {
       v[p[j] * i] = 1;