Pagini recente » Cod sursa (job #867250) | Cod sursa (job #1742607) | Cod sursa (job #1629446) | Cod sursa (job #1457332) | Cod sursa (job #544538)
Cod sursa(job #544538)
#include<fstream.h>
#include<math.h>
ifstream f("ssnd.in");
ofstream g("ssnd.out");
long long m,x,nr=1,sum=1,v[1000005],c[1000005];
int t,P;
void ciur()
{int y;
for(int i=2;i<1000000;i++)
if(c[i]==0)
{y=2;
while(y*i<1000000) c[y*i]=1,y++;
}
m=0;
for(int i=2;i<1000000;i++)
if(c[i]==0) v[++m]=i;
}
void prelucreaza()
{
sum=1,nr=1;
for(int i=1;v[i]*v[i]<=x;i++)
if(x%v[i]==0)
{
int p=0;
while(x%v[i]==0)
{
x/=v[i];
p++;
}
nr*=(p+1);
sum*=((pow(v[i],p+1)-1)/(v[i]-1));
}
if(x!=1)
{
nr*=2;
sum*=((pow(x,2)-1)/(x-1));
}
sum%=P;
g<<nr<<' '<<sum<<'\n';
}
int main()
{
P=9973;
f>>t;
ciur();
for(int i=1;i<=t;i++)
{
f>>x;
prelucreaza();
}
f.close();
g.close();
return 0;
}