Just study the famous paper PRIMES is in P
and get confused.
First step of the proposed algorithm is If (n=a^b for nature number a and b>1), output COMPOSITE.
Since the whole algorithm runs in polynomial time, this step must also complete in O((log n)^c)(given input size is O(log n). However, I can't figure out any algorithm to hit the target after some googling.
QUESTION:
Is there any algorithm available to test whether a number exponent of some other number in polynomial time?
Thanks and Best Regards!
If n=a^b
(for a > 1) then b ≤ log2 n, we can check for all b
's smaller than log n
to test this, we can iterate for finding b
from 2 to log n, and for finding a
we should do binary search between 1..sqrt(n). But binary search takes O(logn
) time for iteration, finally in each step of search(for any found a
for checking) we should check that whether ab == n and this takes O(log n), so total search time will be O(log3n). may be there is a faster way but by knowing that AKS is O(log6n) this O(log3n) doesn't harm anything.