Pagini recente » Cod sursa (job #162931) | Cod sursa (job #2332375) | Cod sursa (job #575936) | Cod sursa (job #1219032) | Cod sursa (job #664327)
Cod sursa(job #664327)
#include <cstdio>
#include <cmath>
#define M 1000000
#define mod 9973
bool ok[M];
using namespace std;
int T,c[M];
long long a,x,b,i,ndiv,s=1,nr,k;
long long powe(int a,int b)
{
if (b==0) return 1;
if (b%2==0)
{
long long aux=powe(a,b/2);
return (aux*aux)%mod;
}
if (b%2==1) return (a*powe(a,b-1))%mod;
}
void ciur()
{
for(int i=2;i<M;i++)
{
if(ok[i] == false)
{
c[++k] = i;
for(int j=i+i;j<M;j+=i)
{
ok[j] = true;
}
}
}
}
int main()
{
freopen("ssnd.in","r",stdin);
freopen("ssnd.out","w",stdout);
scanf("%d",&T);
ciur();
for(;T;T--)
{
s=1LL;
ndiv=1;
scanf("%d",&a);
x=a;
bool ok=false;
for (i=1;c[i]*c[i]<a;i++)
{
nr=0;
while(x%c[i]==0)
{
nr++;
x/=c[i];
}
if (nr!=0) ok=true;
ndiv*=(nr+1);
s*=((powe(c[i],nr+1)-1)/(c[i]-1))%mod;
}
if (ok==false) { ndiv=2; s=a+1;}
printf("%lld ",ndiv);
printf("%lld\n",s);
}
}