Pagini recente » Cod sursa (job #2016719) | pregatire_oji_2 | cvuri | Cod sursa (job #161729) | Cod sursa (job #461279)
Cod sursa(job #461279)
#include <fstream>
using namespace std;
#define dim 1000003
int v[dim], q[100000];
int main()
{
long long i, j, t, n, nr, s;
long long unsigned p, div, aux;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
fin>>t;
int f=0;
for(i=2;i<=1000000;++i)
if(v[i]==0)
{
q[f]=i;
++f;
for(j=i*i;j<=1000000;j+=i)
v[j]=1;
}
for(i=1;i<=t;++i)
{
fin>>n;
j=0;
nr=0;
s=1;
div=1;
aux=n;
while(n>1)
{
p=1;nr=0;
while(n%q[j]==0)
{
++nr;
p*=q[j];
//s=(s+q[j])%9973;
n/=q[j];
}
div*=(nr+1);
s*=(((p*q[j])-1)/(q[j]-1))%9973;
++j;
//n=aux;
}
n=aux;
if(v[n]==0 && n!=1)
fout<<"2" <<" " <<n+1;
else
if(n==1)
fout<<"1" <<" "<<1;
else
fout<<div <<" " <<s%9973 <<'\n';
}
return 0;
}