Pagini recente » Cod sursa (job #1264264) | Cod sursa (job #32070) | Cod sursa (job #1038072) | Cod sursa (job #1835360) | Cod sursa (job #642470)
Cod sursa(job #642470)
#include<stdio.h>
#include<math.h>
#define MOD 666013
long n;
void read () {
scanf("%ld",&n);
}
void eratostene (long p[],long lim) {
long e[2000041];
e[0]=1;
e[1]=1;
for (long i=2;i<=lim;i++)
for (long j=i*i;j<=lim;j=j+i)
e[j]=1;
p[0]=0;
for (long i=1;i<=lim;i++)
if (e[i]==0)
p[++p[0]]=i;
}
long multiplicitate (long &i , long &x) {
long suma=0,numitor=i;
while (x/numitor) {
suma=suma+x/numitor;
numitor*=i;
}
return suma;
}
void rez() {
long e1,e2,e3,nr1,nr2,nr3,expo,t,c,k=1,asd;
long p[1001];
nr1=2*n;
eratostene(p,nr1);
nr2=n;
nr3=n+1;
for (long i=1;i<=p[0];i++) {
e1=multiplicitate(p[i],nr1);
e2=multiplicitate(p[i],nr2);
e3=multiplicitate(p[i],nr3);
expo=e1-e2-e3;
t=p[i];
c=1;
for (;expo>0;expo>>=1) {
if (expo&1)
c=c*t%MOD;
t=t*t%MOD;
}
k=k*c%MOD;
}
printf("%ld\n",k);
}
int main() {
freopen("dirichlet.in","r",stdin);
freopen("dirichlet.out","w",stdout);
read();
rez();
return 0;
}