Pagini recente » Atasamentele paginii teammatesoo | Cod sursa (job #2076570) | Profil _Raoul_16 | Cod sursa (job #2125891) | Cod sursa (job #1714124)
#include<fstream>
#include<bitset>
#include<cmath>
using namespace std;
ifstream fin( "ssnd.in" ); ofstream fout( "ssnd.out" );
const int nmax = 1e6;
const int pmax = 78499;
const int mod = 9973;
int nrp;
int p[ pmax + 1 ];
bool ciur[ nmax / 2 + 1 ];
void ciurulet() {
for( int i = 3; i * i <= nmax; i += 2 ) {
if ( ciur[ i >> 1 ] == 0 ) {
for( int j = i * i; j <= nmax; j += (i << 1) ) {
ciur[ j >> 1 ] = 1;
}
}
}
nrp = 0;
p[ nrp ++ ] = 2;
for( int i = 3; i <= nmax; i += 2 ) {
if ( ciur[ i >> 1 ] == 0 ) {
p[ nrp ++ ] = i;
}
}
p[ nrp ++ ] = nmax + 5;
}
int lgput( int b, int e ) {
int sol = 1;
b %= mod;
while ( e > 0 ) {
if ( e & 1 ) {
sol = (sol * b) % mod;
}
b = (b * b) % mod;
e >>= 1;
}
return sol;
}
int main() {
int t; long long n;
ciurulet();
fin >> t;
while ( t -- ) {
fin >> n;
int suma = 1, lim = sqrt( n );
long long aux = n;
int nrdiv = 1;
for( int i = 0; p[ i ] <= lim; ++ i ) {
if ( aux % p[ i ] == 0 ) {
int b = p[ i ], e = 0;
while ( aux % b == 0 ) {
++ e;
aux /= b;
}
nrdiv *= (e + 1);
suma *= ( (lgput( b, e + 1 ) - 1) * lgput( b - 1, mod - 2 ) ) % mod;
suma %= mod;
}
}
if ( aux > 1 ) {
nrdiv *= 2;
suma = suma * ((aux + 1) % mod) % mod;
}
fout << nrdiv << " " << suma << "\n";
}
fin.close();
fout.close();
return 0;
}