Pagini recente » Cod sursa (job #2374996) | Cod sursa (job #2298810) | Cod sursa (job #590786) | Cod sursa (job #1873382) | Cod sursa (job #1813113)
#include <fstream>
using namespace std;
ifstream fin ("sumdiv.in");
ofstream fout ("sumdiv.out");
#define MOD 9901
int i, a, b, p, q;
long long rez = 1;
long long putere(long long a,long long b)
{
long long ans = 1;
while(b)
if(b & 1) ans *= a,--b;
else a *= a, b /= 2;
return ans;
}
int main()
{
fin >> a >> b;
for(int i = 2; i * i <= a; ++i)
{
if(a % i) continue;
p = i;
q = 0;
while(a % i == 0)
{
++q;
a/=i;
}
rez *= putere(p, 1LL * b * q + 1) - 1;
rez *= putere(p - 1, MOD - 2);
}
if(a > 1)
{
if(a % MOD == 1) rez *= (b + 1);
else
{
rez *= putere(a, b + 1) - 1;
rez *= putere(a - 1, MOD - 2);
}
}
fout << rez << '\n';
return 0;
}