当前位置:网站首页>埃拉托斯特尼筛法
埃拉托斯特尼筛法
2022-07-31 00:35:00 【51CTO】
埃拉托斯特尼筛法(sieve of Eratosthenes )用来找出一定范围(n)内的所有质数。其方法是从 2 开始,在 sqrt(n) 以内,将每个质数的倍数剔除掉,剩下的就是所求范围的质数。例如找 100 以内的质数,先把 2 的倍数筛掉(保留 2),再把 3 的倍数筛掉(保留 3),如此重复下去,直到 7 的倍数被筛掉(因为下一个质数 11 已经大于sqrt(100),剩下的就是 100 以内的质数。
边栏推荐
- DNS解析过程【访问网站】
- (5) fastai application
- mysql索引失效的常见9种原因详解
- [Yugong Series] July 2022 Go Teaching Course 015-Assignment Operators and Relational Operators of Operators
- firewalld
- MySQL数据库的truncate与delete区别
- Go study notes (84) - Go project directory structure
- 从笔试包装类型的11个常见判断是否相等的例子理解:包装类型、自动装箱与拆箱的原理、装箱拆箱的发生时机、包装类型的常量池技术
- Filter (Filter)
- Homework: iptables prevent nmap scan and binlog
猜你喜欢
随机推荐
MySQL master-slave replication and read-write separation script - pro test available
MySQL数据库面试题总结(2022最新版)
MySQL database advanced articles
乌克兰外交部:乌已完成恢复粮食安全出口的必要准备
【愚公系列】2022年07月 Go教学课程 019-循环结构之for
joiplay模拟器不支持此游戏类型怎么解决
ELK deployment script---pro test available
How to solve the error of joiplay simulator
The difference between truncate and delete in MySQL database
Learn Scope from a Compilation Perspective!
redis学习
Neural Network (ANN)
C语言力扣第48题之旋转图像。辅助数组
Linux 部署mysql 5.7全程跟踪 完整步骤 django部署
【愚公系列】2022年07月 Go教学课程 015-运算符之赋值运算符和关系运算符
作业:iptables防止nmap扫描以及binlog
MySQL grant statements
GO GOPROXY proxy Settings
Add text watermark to PHP image
Ukraine's foreign ministry: wu was restored to complete the export of food security