标签:
2 5
2^? mod 2 = 1 2^4 mod 5 = 1
#include<stdio.h> int main(){ int n; while(~scanf("%d",&n)){ if(n==1||n%2==0) printf("2^? mod %d = 1\n",n); else{ int k=2,ncas=1; while(1){ if(k%n==1) break; k=k%n*2; ++ncas; } printf("2^%d mod %d = 1\n",ncas,n); } } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/qq_18062811/article/details/47301609