模p平方根算法实现

2019-04-13 11:39发布

#include #include #include using namespace std; int power(int x,int y,int m)//cal x^y%m { if(y==0)return 1%m; int ret=x%m; for(int i=0;i>p; if(!is_prime(p)) { cout<<"The p should be an odd prime try again please!"<>a; if(power(a,(p-1)/2,p)==p-1) { printf("a:%d p:%d ",a,p); cout<<"No solution for this pair of number"<p)a-=p; int n=getn(p); cout<<"The random n is "<