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

边栏推荐
- Leetcode 113. 路径总和 II
- Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1
- Gym installation, invocation and registration
- Immortal software in the computer that I don't want to delete all my life
- 刷题-洛谷-P1146 硬币翻转
- MLIR原理与应用技术杂谈
- Congestion control of TCP
- Generate SQL script file by initializing the latest warehousing time of vehicle attributes
- 0710RHCSA
- 安装mujoco报错:distutils.errors.DistutilsExecError: command ‘gcc‘ failed with exit status 1
猜你喜欢

刷题-洛谷-P1085 不高兴的津津
![[server data recovery] HP EVA server storage raid information power loss data recovery](/img/ee/8f36ef1b5842f1778c0dd695401b40.jpg)
[server data recovery] HP EVA server storage raid information power loss data recovery

JS Array indexOf includes sort() 冒号排序 快速排序 去重和随机样本 random

Introduction and features of numpy (I)

刷题-洛谷-P1152 欢乐的跳

0715RHCSA
Explain the precision of floating point numbers in detail

刷题-洛谷-P1150 Peter的烟

Install mujoco and report an error: distutils.errors DistutilsExecError: command ‘gcc‘ failed with exit status 1

0716RHCSA
随机推荐
hcip第八天笔记
Sword finger offer special assault edition day 10
Blocking queue for concurrent programming
Mutex lock, spin lock, read-write lock... Clarify their differences and applications
Hcip eighth day experiment
pycharm不能输入中文解决方法
Business visualization - make your flowchart'run'(3. Branch selection & cross language distributed operation node)
0713RHCSA
0716RHCSA
[server data recovery] HP EVA server storage raid information power loss data recovery
刷题-洛谷-P1150 Peter的烟
HTTP cache tongtianpian, there may be something you want
0710RHCSA
JS array indexof includes sort() colon sort quick sort de duplication and random sample random
并发编程之AQS
Int array get duplicate data
JS Array indexOf includes sort() 冒号排序 快速排序 去重和随机样本 random
刷题-洛谷-P1075 质因数分解
Mujoco+spinningup for intensive learning training quick start
0720RHCSA