#include<bits/stdc++.h> using namespace std; long long quick_mod(long long a,long long b,int m) { long long ans = 1; while(b!=0) { if(b&1) years = (years * y)%m; a = (a*a)%m; b /= 2; } return ans; } bool rqui_prime(int x)//x cannot exceed int /// shizhushuyes = true { srand(time(0)); int n = log(x)+7; if(quick_mod(7,x-1,x) != 1) { return false; } for(int i = 0; i < n; i++) { long long k = rand()%10000+7; if((k%x)&&(quick_mod(k,x-1,x)!=1)) { return false; } } return true; }
[Template] - Large prime number determination
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325559976&siteId=291194637
Recommended
Ranking