标签:http io for ar html amp htm ef
#include <cstdio> const int maxn = 70000; int phi[maxn]; void phi_table(int n) { for(int i = 2; i <= n; i++) phi[i] = 0; phi[1] = 1; for(int i = 2; i <= n; i++) if(!phi[i]) for(int j = i; j <= n; j += i) { if(!phi[j]) phi[j] = j; phi[j] = phi[j] / i * (i-1); } } int main() { phi_table(65536); int n; while(scanf("%d", &n) != EOF) { printf("%d\n", phi[n-1]); } return 0; }
题意:求奇素数的原根数
思路:一个数n是奇素数才有原根 原根数是n-1的欧拉函数
POJ 1284 Primitive Roots 原根,布布扣,bubuko.com
标签:http io for ar html amp htm ef
原文地址:http://blog.csdn.net/u011686226/article/details/38638099