예제 #1
0
int main()
{
	int n,count,i;
	shai();
	while(scanf("%d",&n),n!=0)
	{
		count=0;
		for(i=2;i<=n;i++)
			if (a[i]) count++;
		printf("%d\n",count);
	}
	
	return 0;
}
예제 #2
0
int main()
{
	int s,i; 
	int n;
	shai();
	while(scanf("%d",&n)!=EOF)
	{s=0;
		for(i=2;i<=n/2;i++)
	{
		if (a[i]&&a[n-i])  s++;	
	}
    printf("%d\n",s);
	}
	return 0;
}
int main()
{
	int T,a,n,p,i,ans;
	shai();
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d%d",&a,&n);
		p=phi[n];
		ans=0;
		for (i=1;i<=(int)sqrt(p);i++)
			if (p%i==0)
			{
				if (ksm(a,i,n)==1)
					ans=max(ans,i);
				if (ksm(a,p/i,n)==1)
					ans=max(ans,p/i);
			}
		printf("%d\n",ans);
	}
	return 0;
}