Pagini recente » Cod sursa (job #1476715) | Cod sursa (job #3199276) | Cod sursa (job #2123762) | Cod sursa (job #1406131) | Cod sursa (job #2174722)
#include <fstream>
#define MOD 9973
using namespace std;
ifstream f("ssnd.in");
ofstream g("ssnd.out");
bool ciur[1000010];
long long i,j,d,x,nr,sum,s,p,n;
int main()
{
for(d=2;d*d<=1000000;d++)
if(ciur[d]==0)
for(i=d*d;i<=1000000;i=i+d)ciur[i]=1;
ciur[0]=1;
ciur[1]=1;
f>>n;
sum=1;
for(i=1;i<=n;i++)
{
f>>x;
nr=1;
sum=1;
for(d=2;d*d<=x;d++)
{
if(ciur[d]==0)
{
if(x%d==0)
{p=1;
s=d;
while(x%d==0)
{
p++;
s=(s*d);
x=x/d;
}
sum=(sum*(s-1)/(d-1))%MOD;
nr=nr*p;
}
}
}
if(x>1){sum=sum*((x*x-1)/(x-1))%MOD;nr=nr*2;
}
g<<nr<<" "<<sum<<'\n';
}
return 0;
}