Pagini recente » Cod sursa (job #2621439) | Cod sursa (job #2542903) | Cod sursa (job #2713701) | Cod sursa (job #2123636) | Cod sursa (job #2581000)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("ssnd.in");
ofstream fout("ssnd.out");
const int m=9973;
const int nmax=1000005;
int t;
long long n;
bitset<nmax>viz;
vector<int>divi;
int lgp(int a,int b){
int res=1LL,pop=a;
for(int i=0;(1<<i)<=b;i++){
if(b&(1<<i)) res=(res*pop)%m;
pop=(pop*pop)%m;
}
return res;
}
void ciur(){
for(int i=2;i<nmax;i++){
if(viz[i]==0){
divi.push_back(i);
for(int j=i+i;j<nmax;j+=i) viz[j]=1;
}
}
}
int main(){
ciur();
fin >> t;
for(int j=1;j<=t;j++){
fin >> n;
int nrdiv=1,sum=1;
for(auto i:divi){
if(n%i==0){
int cnt=0;
while(n%i==0){
cnt++;
n/=i;
}
nrdiv=(nrdiv*(cnt+1))%m;
int x=(lgp(i,cnt+1)-1)%m;
int y=lgp(i-1,m-2);
sum=(((sum*x)%m)*y)%m;
}
}
if(n>=2){
nrdiv=(nrdiv*2)%m;
sum=(1LL*sum*(n+1))%m;
}
fout << nrdiv << ' ' << sum << '\n';
}
}