# POJ 1845 数学问题

S = (1+p1+p1^2+p1^3+...p1^k1) * (1+p2+p2^2+p2^3+….p2^k2) * (1+p3+ p3^3+…+ p3^k3) * .... * (1+pn+pn^2+pn^3+...pn^kn)

A^B的所有约数之和为：

sum = [1+p1+p1^2+...+p1^(a1*B)] * [1+p2+p2^2+...+p2^(a2*B)] *...* [1+pn+pn^2+...+pn^(an*B)].

#include<cstdio>
using namespace std;
typedef long long ll;
const ll MOD=9901;
ll A,B;

ll pow(ll p,ll n) //快速求幂
{
if(n==0)
{
return 1;
}
if(n&1)
{
return ( pow(p,n-1) * p ) % MOD;
}
ll ret=pow(p,n/2);
return ( ret * ret ) % MOD;
}

ll sum(ll p,ll n)  //等比求和
{
if(n==0)
{
return 1;
}
if(n&1)
{
return ( (1+pow(p,n/2+1)) * sum(p,n/2) ) % MOD;
}
return ( (1+pow(p,n/2+1)) * sum(p,n/2-1) + pow(p,n/2) )% MOD;
}

ll cal()
{
ll ans=1;
ll i,b;
for(i=2;i*i<=A;i++)
{
b=0;
while(A%i==0)
{
A/=i;
b++;
}
ans=(ans*sum(i,b*B))%MOD;
}

if(A!=1)
{
ans=(ans*sum(A,B))%MOD;
}
return ans;
}

int main()
{
while(~scanf("%lld%lld",&A,&B))
{
printf("%lld\n",cal());
}
return 0;
}

10-02 1609

09-17 1695

07-31 6290

10-13 391

01-23 1221

11-29 458

07-23 856

03-15 431

08-13 1945

10-22 564