Pagini recente » Cod sursa (job #2592028) | Cod sursa (job #3198714) | Cod sursa (job #691509) | Cod sursa (job #2837929) | Cod sursa (job #2337744)
#include<bitset>
#include<fstream>
using namespace std;
ifstream cin("ssnd.in");
ofstream cout("ssnd.out");
#define mod 9973
#define m 1000010
bitset <m> bitsett;
void ciur(){
bitsett[1]=1;
for(int i=2; i*i<=m; i++)
if(bitsett[i]==0)
for(int j=i*2; j<=m; j+=i)
bitsett[j]=1;
}
int pow(int a, int b){
int produs=1;
a%=mod;
for(;b; b>>=1){
if(b&1)
produs=(a*produs)%mod;
a=(a*a)%mod;
}
return produs;
}
int main()
{
ciur();
bool ok=0;
long long suma=1, nr=1,n;
int t, put=0;
cin>>t;
while(t){
cin>>n;
ok=1;
if(n<m)
if(bitsett[n]==0){
cout<<2<<' '<<n+1;
ok=0;
}
if(ok){
for(long long i=2; i*i<=n; i++){
if(bitsett[i]==0){
while(n%i==0){
n/=i;
put++;
}
int p1 = (pow(i, put+1) - 1) % mod;
int p2 = pow(i-1, mod-2) % mod;
suma=(((suma*p1)%mod)*p2)%mod;
nr*=put+1;
put=0;
}
}
if(n>1){
nr*=2;
suma=(suma*(n+1))%mod;
}
cout<<nr<<' '<<suma<<'\n';
nr=1;
suma=1;
}
t--;
}
return 0;
}