POJ1284 Primitive Roots (原根)】的更多相关文章

题目链接:http://poj.org/problem?id=1284 题目描述: 题目大意: 一个质数原根的个数 题解: 结论题 一个数n的原根的个数等于$\varphi(\varphi(n))$ #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; +; int p,tot;…
题目传送门 Primitive Roots Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5434   Accepted: 3072 Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (xi mod p) | 1 <= i <= p-1 }…
题目来源:POJ 1284 Primitive Roots 题意:求奇素数的原根数 思路:一个数n是奇素数才有原根 原根数是n-1的欧拉函数 #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])…
Primitive Roots Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4775   Accepted: 2827 Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (xi mod p) | 1 <= i <= p-1 } is eq…
题目:http://poj.org/problem?id=1284 题意:就是求一个奇素数有多少个原根 分析: 使得方程a^x=1(mod m)成立的最小正整数x是φ(m),则称a是m的一个原根 然后有这样的定理: 1.所有奇素数都有原根 2.如果一个数n有原根,那么原根个数为φ(φ(n)) 由性质2就可知道,对于此题的奇素数n,结果就是φ(n-1)…
模板题,可用于求一个数的所有原根. #include<bits/stdc++.h> using namespace std; typedef long long ll; ,inf=0x3f3f3f3f; int n,fac[N],nf; vector<int> ans; int Pow(int x,int p,int mod) { ; ,x=(ll)x*x%mod))ret=(ll)ret*x%mod; return ret; } int phi(int x) { int ret=…
Primitive Roots   Description We say that integer x, 0 < x < n, is a primitive root modulo n if and only if the minimum positive integer y which makes x y = 1 (mod n) true is φ(n) .Here φ(n) is an arithmetic function that counts the totatives of n,…
Primitive Roots Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 5709 Accepted: 3261 Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set (ximodp)∣1≤i≤p−1{ (x_i mod p) | 1 \leq i \leq…
Primitive Roots Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2479   Accepted: 1385 Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (xi mod p) | 1 <= i <= p-1 } is eq…
Primitive Roots http://poj.org/problem?id=1284 Time Limit: 1000MS   Memory Limit: 10000K       Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (xi mod p) | 1 <= i <= p-1 } is equal…