当前位置:网站首页>埃拉托斯特尼筛法
埃拉托斯特尼筛法
2022-07-31 00:35:00 【51CTO】
埃拉托斯特尼筛法(sieve of Eratosthenes )用来找出一定范围(n)内的所有质数。其方法是从 2 开始,在 sqrt(n) 以内,将每个质数的倍数剔除掉,剩下的就是所求范围的质数。例如找 100 以内的质数,先把 2 的倍数筛掉(保留 2),再把 3 的倍数筛掉(保留 3),如此重复下去,直到 7 的倍数被筛掉(因为下一个质数 11 已经大于sqrt(100),剩下的就是 100 以内的质数。

边栏推荐
- 【Yugong Series】July 2022 Go Teaching Course 017-IF of Branch Structure
- [In-depth and easy-to-follow FPGA learning 13---------Test case design 1]
- 【愚公系列】2022年07月 Go教学课程 016-运算符之逻辑运算符和其他运算符
- background对float的子元素无效
- 分布式系统的一致性与共识(1)-综述
- 【Yugong Series】July 2022 Go Teaching Course 013-Constants, Pointers
- 45. [Application of list linked list]
- The difference between truncate and delete in MySQL database
- joiplay模拟器如何调中文
- Shell编程之条件语句
猜你喜欢

Gabor滤波器学习笔记

How to solve the error of joiplay simulator

How to import game archives in joiplay emulator

消息队列存储消息数据的MySQL表设计

【深入浅出玩转FPGA学习13-----------测试用例设计1】

Encapsulate and obtain system user information, roles and permission control

How to Repair Word File Corruption

joiplay模拟器如何使用

joiplay模拟器如何调中文

IOT跨平台组件设计方案
随机推荐
MPI简谈
如何在WordPress网站上添加导航菜单
正则表达式密码策略与正则回溯机制绕过
MySQL的grant语句
Optimization of aggregate mentioned at DATA AI Summit 2022
Method for deduplication of object collection
常用的正则表达式
MySQL master-slave replication and read-write separation script - pro test available
GO GOPROXY代理设置
Error occurred while trying to proxy request项目突然起不来了
牛客网刷题训练(四)
什么是Promise?Promise的原理是什么?Promise怎么用?
MySQL中substring与substr区别
【Yugong Series】July 2022 Go Teaching Course 017-IF of Branch Structure
会议OA项目待开会议、所有会议功能
SWM32系列教程6-Systick和PWM
Filter (Filter)
【深入浅出玩转FPGA学习15----------时序分析基础】
过滤器(Filter)
Consistency and Consensus of Distributed Systems (1) - Overview