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

feat: 随机质数 #163

Open
Mr-Python-in-China opened this issue Feb 15, 2025 · 5 comments
Open

feat: 随机质数 #163

Mr-Python-in-China opened this issue Feb 15, 2025 · 5 comments

Comments

@Mr-Python-in-China
Copy link
Collaborator

有一些题目的模数是输入给定的。需要一个函数,可以方便地随机区间内一个质数。

@Mr-Python-in-China
Copy link
Collaborator Author

Image

Image

看着相当靠谱!

@Sving1024
Copy link

Sving1024 commented Feb 15, 2025

自增的话不一定是均匀生成的吧。话说为什么不能直接筛。

@Mr-Python-in-China
Copy link
Collaborator Author

自增的话不一定是均匀生成的吧。话说为什么不能直接筛。

想均匀太难了。质数本身都不是均匀的。
这样在值域上会很均匀

@weilycoder
Copy link
Contributor

自增的话不一定是均匀生成的吧。话说为什么不能直接筛。

想均匀生成可以调 prime_sievechoice 一个就完了,应该还是简单的;但是复杂度是 $O(V)$ 的,如果在范围内随一个数再向后查找就是期望 $O(\log V)$ 的了

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

No branches or pull requests

3 participants