2 2 s 64 MB
This problem statement contains superscipts that may not display properly outside the applet.
Lun the dog loves very large integers. Her favorite is $A^B$ ($A$ to the power of $B$).
She has an integer variable $X$. Initially, the value of $X$ is set to 1. She can perform the following two kinds of operations in any order, any number of times.
You are given two ints $A$ and $B$.
$A$ will be between $2$ and $1,000,000$ ($10^6$), inclusive.
$B$ will be between $1$ and $1,000,000$ ($10^6$), inclusive.
Return the minimum number of operations Lun needs to perform in order to obtain $X$ = $A^B$ from the initial state $X = 1$.