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

素数/质数 | caojiangxia #18

Open
caojiangxia opened this issue Feb 25, 2019 · 0 comments
Open

素数/质数 | caojiangxia #18

caojiangxia opened this issue Feb 25, 2019 · 0 comments

Comments

@caojiangxia
Copy link
Owner

https://caojiangxia.github.io/2019/02/24/Prime/#more

素数/质数素数/质数是一个非常容易被考察的点,其定义很简单:只有1和其本身能够将其整除。关于素数,衍生出了很多理论,这些理论对求解问题时能够极大的加速算法。本文我们探讨素数判定问题。 暴力判断这个就很简单了,由于除数肯定比被除数要小,所以我们对每个数进行枚举判断即可。时间复杂度$O(n)$ 1234567bool Is_prime(int n){ for(int i=2;i<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant