码迷,mamicode.com
首页 >  
搜索关键字:prime    ( 2475个结果
HDU 4135 Co-prime (分解质因数 + 容斥)
HDU 4135 Co-prime (分解质因数 + 容斥)...
分类:其他好文   时间:2015-08-16 10:48:44    阅读次数:97
hdu 4135 Co-prime(容斥)
Co-primeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2307Accepted Submission(s): 861 Problem D...
分类:其他好文   时间:2015-08-16 07:09:15    阅读次数:161
EularProject 47:具有相同个数因子的连续数字
Distinct primes factors Problem 47 The first two consecutive numbers to have two distinct prime factors are:14 = 2 × 7 15 = 3 × 5The first three consecutive numbers to have three distinct prime fact...
分类:其他好文   时间:2015-08-15 21:36:32    阅读次数:233
【快速判断素数,10^9】
看到了一个很神的模板,具体什么意思还不理解,先马了再研究~ 1 bool prime (long long num) 2 { 3 if (num == 2 || num == 3 || num == 5) 4 return true; 5 if (nu...
分类:其他好文   时间:2015-08-15 21:19:57    阅读次数:108
HDU 1058 Humble Numbers
DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18,...
分类:其他好文   时间:2015-08-15 10:11:34    阅读次数:161
c++判断素数函数
#include#include#includeusing namespace std;int prime (int a){ bool pr; pr=false; int s; s=0; for (int i=1;i<=a;i++) if ...
分类:编程语言   时间:2015-08-14 18:51:58    阅读次数:156
判断素数——Dirichlet's Theorem on Arithmetic Progressions
Description If a and d are relatively prime positive integers, the arithmetic sequence beginning with a and increasing by d, i.e., a, a + d, a + 2d, a + 3d, a + 4d, ..., contains infinitely man...
分类:其他好文   时间:2015-08-14 17:07:58    阅读次数:77
HDU Prime Ring Problem (DFS+素数打表)
Problem Description A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime...
分类:其他好文   时间:2015-08-14 15:45:56    阅读次数:113
生成素数序列----埃拉托斯特尼筛法
下面是埃拉托斯特尼筛法的实现代码: boolean[] sieveOfEratosthenes(int max) { boolean[] flags = new boolean[max + 1]; int count = 0; init(flags);//将flags中0,1元素除外的所有元素设为true int prime = 2; while (prime { //划掉余下...
分类:其他好文   时间:2015-08-13 22:13:15    阅读次数:175
PAT 1059. Prime Factors (25)
1059. Prime Factors (25)Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1* p2^k2...
分类:其他好文   时间:2015-08-12 23:16:27    阅读次数:130
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!