Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[内容有误] 线性筛注释与代码需改正 #4535

Closed
1 task
cubeheadsun opened this issue Dec 25, 2022 · 2 comments · Fixed by #4538
Closed
1 task

[内容有误] 线性筛注释与代码需改正 #4535

cubeheadsun opened this issue Dec 25, 2022 · 2 comments · Fixed by #4538
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed

Comments

@cubeheadsun
Copy link
Contributor

cubeheadsun commented Dec 25, 2022

请选择:

  • 我正在着手修复这个问题

我正在访问这个页面

https://oiwiki.vx.st/math/number-theory/sieve/

我发现页面有这样的问题

线性筛有点问题,第一是注释,第二是代码。
因为在文章中,并没有说要筛出小于MAXN的个数,反而在前面说过是1-n,所以应该改成<=MAXN才对,并且应该把 if (1ll * i * pri[j] >= MAXN) break;改成if (1ll * i * pri[j] > MAXN) break;
除了这点之外,注释的描述也又问题,应把由于 pri 里面质数是从小到大的,所以 i 乘上其他的质数的结果一定也是 pri[j] 的倍数 它们都被筛过了,就不需要再筛了,所以这里直接 break掉就可以了改为由于 pri里面质数是从小到大的,所以 i 乘上其他的质数的结果一定会被 pri[j]的倍数筛掉,就不需要在这里先筛一次,所以这里直接 break 掉就好了
@cubeheadsun cubeheadsun added Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed labels Dec 25, 2022
@welcome
Copy link

welcome bot commented Dec 25, 2022

感谢你对 OI Wiki 的关注!记得在 Issue 中表达清楚自己的意思哦~

@cubeheadsun
Copy link
Contributor Author

也不太确定我说的对不对,我太菜了QWQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content Bug / 页面内容有误 Something isn't working help wanted / 需要帮助 Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant