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 to { 1, …, p-1 }. For example, the consecutive power...
分类:
其他好文 时间:
2015-06-04 22:54:39
阅读次数:
231
Description
Given n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such t...
分类:
其他好文 时间:
2015-06-04 22:54:18
阅读次数:
175
转载请注明出处 [ametake版权所有]http://blog.csdn.net/ametake欢迎来看看
题目来源:SDOI2008
文章被剽窃很严重啊 所以以后都带上版权信息
先上题目
题目描述 Description
作为体育委员,C君负责这次运动会仪仗队的训练。仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪仗队的左后方,...
分类:
其他好文 时间:
2015-06-04 19:33:24
阅读次数:
136
题意:
给一个L,求长度最小的全8数满足该数是L的倍数。
分析:
转化为求方程a^x==1modm。之后就是各种数学论证了。
代码:
//poj 3696
//sep9
#include
#include
using namespace std;
typedef long long ll;
ll L;
ll factor[65536];
ll mul(ll x,ll y,ll p)...
分类:
其他好文 时间:
2015-06-04 19:30:45
阅读次数:
140
题意:
求f(n)=∑gcd(i, N) 1
分析:
f(n)是积性的数论上有证明,且f(n)=sigma{1
代码:
//poj 2480
//sep9
/*
f(pi^ai) = Φ(pi^ai)+pi*Φ(pi^(ai-1))+pi^2*Φ(pi^(ai-2))+...+pi^(ai-1)* Φ(pi)+ pi^ai *Φ(1)
= pi^(ai-1)*(pi-1) +...
分类:
其他好文 时间:
2015-06-03 09:54:21
阅读次数:
109
light_oj 1370 欧拉函数+二分A -Bi-shoe and Phi-shoeTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%lld & %lluSubmitStatusDescriptionBamboo Pole-vault i...
分类:
其他好文 时间:
2015-06-01 22:21:04
阅读次数:
115
我们先来看一下最经典的埃拉特斯特尼筛法。时间复杂度为O(n loglog n)
int ans[MAXN];
void Prime(int n)
{
int cnt=0;
memset(prime,1,sizeof(prime));
prime[0]=prime[1]=0;
for(int i=2;i<n;i++)
{
if(vis[i])
{
ans[cnt++]=...
分类:
其他好文 时间:
2015-05-30 09:24:54
阅读次数:
277
//求a , b范围内的所有的欧拉函数
//筛选法求欧拉函数模板题
#include
#include
#include
using namespace std ;
const int maxn = 3000010 ;
typedef __int64 ll ;
int e[maxn] ;
int a , b ;
void Euler()
{
int i,j;
...
分类:
其他好文 时间:
2015-05-29 20:24:48
阅读次数:
109
//求小于N且n/phi(x)最大的n如果有多个,输出最小的
//phi(x) = x*(1-1/p1)*(1-1/p2)*(1-1/p3)....
//要使得x/phi(x) 最大,即使得(1-1/p1)*(1-1/p2)*(1-1/p3)....最小
//又p1, p2 , p3 , ....
//全为素数因子,所以可以对枚举所有素数因子乘积,
//打表后找小于等于n的数
#inc...
分类:
其他好文 时间:
2015-05-29 18:11:25
阅读次数:
102
//求小于n且和n不互质的所有数之和
//若gcd(n , i) == 1 那么 gcd(n , n-i) == 1
//可以用反证法
//设gcd(n , n-i) != 1;
//那么可以有 n = k1*a
//n - i = k2*a ;
//i = (k1-k2)*a
//gcd(n ,i) != 1
//那么 ans = n*(n-1)/2 - n*euler(n)/...
分类:
其他好文 时间:
2015-05-28 23:16:33
阅读次数:
313