Topics address
See the solution to a problem that question, chiefs say this is primary Mathematical Olympiad,Cai I can not get the sound of chickens。
Seeking \ (a ^ b \) all about the number of and the MOD \ (9901 \) \ ((. 1 <= A, B <=. 5. 7 * 10 ^) \)
answer
Solving the problem, I also quickly see a bit unique decomposition theorem
We first \ (a \) decomposition of the quality factor
\[a=p_1^{c_1}*p_2^{c_2}*...*p_n^{c_n}\]
For example, \ (12 \) can be divided into \ (2 ^ 2 ^ 3 + 1 \) it
Because power is multiplied with the index, the index unchanged, multiplied by the base number , so there is:
\[a^b=p_1^{c_1*b}*p_2^{c_2*b}*...*p_n^{c_n*b}\]
The Unique Factorization Theorem, \ (A ^ B \) divisors and is
\[(1+p_1+p_1^2+...+p_1^{c_1*b})*(1+p_2+p_2^2+...+p_2^{c_2*b})*...*(1+p_3+p_3^2+...+p_3^{c_3*b})\]
Gangster saw a geometric sequence, and I do not see it that konjac
Because the geometric series summation formula dividing use, division is not satisfied \ (\ text {mod} \ ) distributive law
So we usher in this topic focus - Divide and Conquer
Set \ (\ {text} SUM (P, C) \) , for the \ ((1 + p + p ^ 2 + ... + p ^ {c}) \)
- If \ (C \) is odd, there are
\[\text{sum}(p,c)=(1+p+...+p^{\frac{c-1}{2}})+(p^{\frac{c+1}{2}}+...+p^c)\]
\[=1*(1+p+...+p^{\frac{c-1}{2}})+\frac{c+1}{2}*(1+p+...+p^{\frac{c-1}{2}})\]
\[=(1+\frac{c+1}{2})*\text{sum}(p,\frac{c-1}{2})\]
- If \ (c \) is an even number, there are similar
\[\text{sum}(p,c)=(1+\frac{p}{2})*\text{sum}(p,\frac{p}{2}-1)*p^c\]
Combined with rapid power, the time complexity can get by
Talk so much (though reading), I forgot to tell you this is the title of my mouth Hu.