Pagini recente » Cod sursa (job #181842) | Cod sursa (job #3285898) | Cod sursa (job #3250079) | Cod sursa (job #2225928) | Cod sursa (job #3121831)
#include <fstream>
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
const int MOD = 9901;
int lgput(int b, int e, int mod) {
b %= mod;
/*if(b == 1)
return (e + 1) % mod;*/
int pow = 1;
while(e){
if(e & 1)
pow = (pow * b) % mod;
b = ((long long) b * b) % mod;
e >>= 1;
}
return pow;
}
int invmod(int a, int mod) {
return lgput(a, mod - 2, mod);
}
int main() {
int a, b;
fin >> a >> b;
int sum_div = 1, d = 3, p = 0;
while(!(a & 1)){
a >>= 1;
++p;
}
if(p){
sum_div = sum_div * (lgput(2, b * p + 1, MOD) + MOD - 1) % MOD;
sum_div = sum_div * invmod(1, MOD) % MOD;
}
while(d * d <= a){
p = 0;
while(a % d == 0){
a /= d;
++p;
}
if(p)
sum_div = sum_div * (lgput(d, p * b + 1, MOD) + MOD - 1) % MOD * invmod(d - 1, MOD) % MOD;
d += 2;
}
if(a > 1)
sum_div = sum_div * (lgput(a, 1 * b + 1, MOD) + MOD - 1) % MOD * invmod(a - 1, MOD) % MOD;
fout << sum_div << '\n';
fin.close();
fout.close();
return 0;
}