文件名称:常用函数
-
所属分类:
- 标签属性:
- 上传时间:2017-12-29
-
文件大小:482kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
用筛法求素数的基本思想是:把从1开始的、某一范围内的正整数从小到大顺序排列, 1不是素数,首先把它筛掉。剩下的数中选择最小的数是素数,然后去掉它的倍数。依次类推,直到筛子为空时结束。如有:
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
1不是素数,去掉。剩下的数中2最小,是素数,去掉2的倍数,余下的数是:
3 5 7 9 11 13 15 17 19 21 23 25 27 29
剩下的数中3最小,是素数,去掉3的倍数,如此下去直到所有的数都被筛完,求出的素数为:
2 3 5 7 11 13 17 19 23 29(The basic idea of using sieve to find prime numbers is to set up the positive integers from 1 to a certain extent, and 1 are not prime numbers. The smallest number in the remaining number is a prime number, and then the multiple of it is removed. The analogy is in turn until the sieve ends when it is empty. If there are:
12345678910
111213141516171819 20
212223242526272829 30
1 is not a prime number, get rid of it. The smallest number in the remaining 2 is the prime number, and the number of 2 is removed, and the remaining number is:
3579111315171921 23252729)
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30
1不是素数,去掉。剩下的数中2最小,是素数,去掉2的倍数,余下的数是:
3 5 7 9 11 13 15 17 19 21 23 25 27 29
剩下的数中3最小,是素数,去掉3的倍数,如此下去直到所有的数都被筛完,求出的素数为:
2 3 5 7 11 13 17 19 23 29(The basic idea of using sieve to find prime numbers is to set up the positive integers from 1 to a certain extent, and 1 are not prime numbers. The smallest number in the remaining number is a prime number, and then the multiple of it is removed. The analogy is in turn until the sieve ends when it is empty. If there are:
12345678910
111213141516171819 20
212223242526272829 30
1 is not a prime number, get rid of it. The smallest number in the remaining 2 is the prime number, and the number of 2 is removed, and the remaining number is:
3579111315171921 23252729)
相关搜索: 筛法求素数
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
筛法求素数.exe | 401405049 | 2016-12-27 |
筛法求素数.cpp | 774 | 2016-12-27 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.