Pagini recente » Cod sursa (job #2536894) | Cod sursa (job #680885) | Cod sursa (job #2312353) | Cod sursa (job #630478) | Cod sursa (job #2580983)
#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;
long long lgp(int a,int b){
long long 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;
while(t--){
fin >> n;
long long nrdiv=1LL,sum=1LL;
for(auto i:divi){
if(n%i==0){
int cnt=0;
while(n%i==0){
cnt++;
n/=i;
}
nrdiv*=(cnt+1LL);
nrdiv=(nrdiv)%m;
if(cnt){ long long x=(lgp(i,cnt+1LL)-1LL);
sum=(sum*x)%m;
x=lgp(i-1LL,m-2LL);
sum=(sum*x)%m; } }
}
if(n>=2LL){
nrdiv=(nrdiv*2)%m;
sum=(sum*(n+1))%m;
}
fout << nrdiv << ' ' << sum << '\n';
}
}