#include<bits/stdc++.h>
#define sz 65100
using namespace std;
long status[65100];
void sieve()
{
long long i,j;
status[1]=1,status[0]=1;
for(i=3;i<=sz;i++)
{
if(status[i]==0)
{
for(j=i*i;j<=sz;j+=i)
{
status[j]=1;
}
}
}
}
long long bigmod(long long base,long long power,long long mod)
{
long long ret=1;
while(power)
{
if(power & 1)
ret=(ret*base)%mod;
base = (base*base)%mod;
power=power>>1;
}
return ret;
}
main()
{
sieve();
long long n;
while(cin>>n)
{
long long i1,xx,f=0;
if(n==0)
break;
else
{
if(status[n]==0)
{
printf("%lld is normal.\n",n);
}
else
{
for(i1=2;i1<n;i1++)
{
xx=bigmod(i1,n,n);
if(xx!=i1)
{
f=1;
break;
}
}
// cout<<f<<endl;
if(f==0)
{
printf("The number %lld is a Carmichael number.\n",n);
}
else
{
printf("%lld is normal.\n",n);
}
}
}
}
}
#define sz 65100
using namespace std;
long status[65100];
void sieve()
{
long long i,j;
status[1]=1,status[0]=1;
for(i=3;i<=sz;i++)
{
if(status[i]==0)
{
for(j=i*i;j<=sz;j+=i)
{
status[j]=1;
}
}
}
}
long long bigmod(long long base,long long power,long long mod)
{
long long ret=1;
while(power)
{
if(power & 1)
ret=(ret*base)%mod;
base = (base*base)%mod;
power=power>>1;
}
return ret;
}
main()
{
sieve();
long long n;
while(cin>>n)
{
long long i1,xx,f=0;
if(n==0)
break;
else
{
if(status[n]==0)
{
printf("%lld is normal.\n",n);
}
else
{
for(i1=2;i1<n;i1++)
{
xx=bigmod(i1,n,n);
if(xx!=i1)
{
f=1;
break;
}
}
// cout<<f<<endl;
if(f==0)
{
printf("The number %lld is a Carmichael number.\n",n);
}
else
{
printf("%lld is normal.\n",n);
}
}
}
}
}
UVA
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন