- 博客(5)
- 收藏
- 关注
原创 miller_rabin素性测试
#include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; typedef long long LL; LL mul(LL a,LL b,LL mod) //一个LL*LL的黑科技 { LL tmp=(a*b-(LL)((long dou...
2018-06-04 17:26:53 210
原创 Meisell-Rabin米勒拉宾筛质数选法
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> int prime(int n) { int i, j; int count = 0;/**16以内有10个合数**/ char* flag = (char*)malloc...
2018-06-04 17:24:45 211
原创 欧拉质数筛选法
#include <stdio.h> #include <stdlib.h> #include <time.h> #define PressEnter \ {\ fflush(stdin); /*fflush()清空输入缓冲区的函数*/\ printf("Press Enter...");\ getchar();\ fflush...
2018-06-04 17:21:05 785
原创 Eraosthenes质数数筛选法
#include <stdio.h> #include <stdlib.h> #include <time.h> int prime(int N,unsigned long long int* sum) { unsigned int i,j,k,count_p=0; if(N>100000000) i=17; el...
2018-06-04 17:12:14 294
原创 遍历模除质数筛选法
#include <stdio.h> #include <stdlib.h> #include <time.h> /** 算法逻辑解析:一个数a除以a前边所有的质数都除不尽,则a也为质数。 此例中,Prime[]数组存放已确认的质数,偶数跳过,直接确认奇数是否为质数。 易错点:核心逻辑是a于Prime[]数组中已存在的数都要判断,都除不尽a才是质数, 有一个除...
2018-06-04 17:08:42 345
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人