Pagini recente » Borderou de evaluare (job #243485) | Cod sursa (job #1970462) | Cod sursa (job #3245338) | Cod sursa (job #2627471) | Cod sursa (job #1988606)
#include <fstream>
#include <cmath>
#define ll long long
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
bool v[1000001];
int vect[260001],putere1[25001],divizor[25001];
ll cnt=0,i,j;
void ciur()
{
for(i=2; i<=1000000; i++)
{
if(v[i]==0)
{
cnt++,vect[cnt]=i;
for(j=i*i; j<=1000000; j+=i) v[j]=1;
}
}
}
int main()
{
int t,cnt1,val=-1,putere,x,copie,k,l;
unsigned long long n,S,P;
fin >> t;
ciur();
for(i=1; i<=t; i++)
{
fin >> n,j=1,cnt1=0,P=1,S=1,putere=0;
while(n>1)
{
copie=vect[j];
if(n%copie==0) n/=copie,putere++,val=copie;
else cnt1++,putere1[cnt1]=putere,divizor[cnt1]=val,putere=0,j++;
}
cnt1++,putere1[cnt1]=putere,divizor[cnt1]=val;
for(k=1; k<=cnt1; k++)
P*=(putere1[k]+1),S*=(pow(divizor[k],putere1[k]+1)-1)/(divizor[k]-1),S=S%9973;
fout << P << " " << S << "\n";
}
return 0;
}