Let's say that we have a number of the form $n^n$.
How many integer pairs of the form $a^b$ are equivalent to this number?
for example, let's say that $n=8$
We have $2^{24}$, $(-2)^{24}$, $4^{12}$, $(-4)^{12}$, $8^8$, $(-8)^8$, $16^6$, $(-16)^6$, $64^4$, $(-64)^4$, $256^3$, $4096^2$, $(-4096)^2$, $16777216^1$.
If we limit this to positive numbers, then it is easy to see if a negative number would work because it does if and only if $b$ is even.
My thought process thus far is it has to do with the number of factors of $n$ but I'm kind of stuck on what to do from there because I was looking for a closed form and kind of only see a brute force check right now.
Indeed since $$n^{ab}=(n^a)^b$$ The answer is the number of divisors (times two, if the exponent is even).
But if you are looking for a closed formula (https://en.m.wikipedia.org/wiki/Divisor_function) you are out of luck.