If $a$ and $b$ are whole numbers from $1$ to $100$, how many pairs of numbers $(a,b)$ are there which satisfy $a^{\sqrt{b}}=\sqrt{a^b}$

If $a$ and $b$ are whole numbers from $1$ to $100$, how many pairs of numbers $(a,b)$ are there which satisfy $a^{\sqrt{b}}=\sqrt{a^b}$

This was from a math contest I did earlier today and I was completely stumped how to solve this!

Other than the trivial $a=1=b$ and when $b=4$ then $a \in [1,100]$

Which means there are $101$ cases but are there any more?

• You have $98$ more for $a = 1$ and $b$ arbitrary. – user258700 Jul 28 '16 at 5:10

$$a^{\sqrt{b}}=\sqrt{a^b}$$
$$a^{2\sqrt{b}}=a^b$$
Case 1: $a=1$. It holds regardless of $b$. ($100$ cases)
Case 2: If $a \neq 1$, $2\sqrt{b}=b \implies b=4$ ($99$ cases)
Note that $\sqrt{a^b}=(a^b)^{1/2}=a^{b/2}$. If $a>1$, then $a^{\sqrt{b}}=a^{b/2}$ iff $\sqrt{b}=b/2$, which happens only for $b=4$. On the other hand, if $a=1$, then $b$ can be anything and both sides will be $1$. So the solutions are $(1,b)$ for any $b$ and $(a,4)$ for any $a$. There are $100$ solutions in each of these cases, but both cases include $(1,4)$, so you get $199$ solutions in total.