Pagini recente » Cod sursa (job #2324499) | Cod sursa (job #820122) | Cod sursa (job #138203) | Cod sursa (job #1335173) | Cod sursa (job #434258)
Cod sursa(job #434258)
#include <cstdio>
#include <bitset>
using namespace std;
const int RNMAX = 100010;
const int modulo = 9901;
long long e[RNMAX], RAD = 0;
long long A, B;
void ciur()
{
bitset<RNMAX> b;
for(int i = 2 ; i * i < RNMAX ; i++)
if(!b[i])
for(int j = i * i ; j < RNMAX ; j += i)
b[j] = 1;
for(int i = 2 ; i <= RNMAX ; i++)
if(!b[i])
e[++RAD] = i;
}
int putere(int a, int p)
{
int rez = 1;
a = a % modulo;
for(; p ; p = p>>1)
{
if(p & 1)
rez = (rez * a) % modulo , p--;
a = (a * a) % modulo;
}
return rez;
}
void rezolva()
{
long long n = A;
int S = 1;
for(int i = 1 ; e[i] * e[i] <= A ; i++)
if(A % e[i] == 0)
{
int s = 1;
while(n % e[i] == 0)
{
n /= e[i];
s = (s * putere(e[i], B)) % modulo;
}
S = (S * (s * e[i] - 1)) % modulo;
S = (S * putere(e[i] - 1, modulo - 2)) % modulo;
}
if(n > 1)
{
int s = putere(n, B) % modulo;
S = (S * (s * n - 1)) % modulo;
S = (S * putere(n - 1, modulo - 2)) % modulo;
}
printf("%lld", S);
}
int main()
{
freopen("sumdiv.in","r",stdin);
freopen("sumdiv.out","w",stdout);
ciur();
scanf("%lld%lld",&A,&B);
rezolva();
return 0;
}