Pagini recente » Cod sursa (job #631726) | Cod sursa (job #2099726)
#include <bits/stdc++.h>
#define in "ssnd.in"
#define out "ssnd.out"
#define oo 9973
#define nmax 1000003
using namespace std;
ifstream fin(in);
ofstream fout(out);
int t;
int n;
int ciur[nmax];
void prime()
{
int i,j;
ciur[0] = 1;
ciur[1] = 1;
for (i = 4; i <= nmax; i += 2)
ciur[i] = 1;
for (i = 3; i*i <= nmax; i += 2)
if (ciur[i] == 0)
for (j = i*i; j <= nmax; j+= (2*i))
ciur[j] = 1;
}
long long RidLog(long long x, int n)
{
long long p = 1;
while (n > 0)
{
if (n & 1)
{
p *= x;
n--;
}
x = x * x;
n >>= 1 ;
}
return p;
}
void Ssnd(int n)
{
int i,p;
long long sum = 1, nrdiv = 1;
for (i = 2; i <= n; i++)
if (ciur[i] == 0 && n%i == 0)
{
p = 0;
while (n%i == 0)
{
p++;
n /= i;
}
nrdiv = nrdiv * (p+1);
sum = sum * (RidLog(i,p+1) - 1) / (i - 1)%oo;
/// if (ciur[n] == 0) i = n;
}
fout << nrdiv << " " << sum%oo << "\n";
}
int main()
{
prime();
fin >> t;
while (t--)
{
fin >> n;
Ssnd(n);
}
fin.close();
fout.close();
return 0;
}