Problem H. Law of Commutation
时间限制 1000 ms
内存限制 32 MB
As we all know, operation ''+'' complies with the commutative law. That is, if we arbitrarily select two integers $a$ and $b$, $a + b$ always equals to $b + a$. However, as for exponentiation, such law may be wrong. In this problem, let us consider a modular exponentiation. Give an integer $m = 2^n$ and an integer $a$, count the number of integers $b$ in the range of $[1,m]$ which satisfy the equation $a^b \equiv b^a$ (mod $m$).
输入数据
输出数据
For each test case, output an integer denoting the number of $b$.
样例输入
样例输出
$ Mathjax font initiator $