Pagini recente » Cod sursa (job #2330227) | Cod sursa (job #1668732) | Cod sursa (job #3213591) | Cod sursa (job #2166070) | Cod sursa (job #2122390)
#include <iostream>
#include <cmath>
#include <vector>
#include <fstream>
#include <unordered_map>
#define ll long long
using namespace std;
ifstream fcin("ssnd.in");
ofstream fcout("ssnd.out");
const ll NLIM = 1e12 + 10;
const int MOD = 9973;
int T;
ll N;
int nprim[1000000 + 10];
int primesSize = 0;
int primes[1000000];
void calcSiev()
{
nprim[1] = 1;
for( int i = 2; i <= 1000; ++i )
{
if( !nprim[i] )
{
for( int j = i * i; j < 1000000; j += i )
nprim[j] = 1;
}
}
for( int i = 1; i <= 1000000; ++i )
if( !nprim[i] )
primes[primesSize++] = i;
}
int main()
{
calcSiev();
ios::sync_with_stdio( false );
fcin >> T;
while( T-- )
{
fcin >> N;
int gy = sqrt( N );
// int gy = N;
int nr = 1;
ll sum = 1;
// unordered_map< ll, int > p;
for( int i = 0; i < primesSize && primes[i] <= gy; ++i )
{
int a = 0;
ll pored = 1;
ll hsum = 1;
while( N % primes[i] == 0 )
{
a++;
N /= primes[i];
pored *= primes[i];
hsum += pored;
hsum %= MOD;
}
//cout << primes[i] << " " << a << "\n";
nr *= a + 1;
sum *= hsum;
sum %= MOD;
}
if( nr == 1 )
{
nr = 2;
sum = N + 1;
}
else if( N > 1 && N > gy )
{
nr *= 2;
sum *= N + 1;
sum %= MOD;
}
fcout << nr << " " << sum << "\n";
}
}