# Is $n^n$ a perfect square or not?

If $n$ is an integer, how do you know whether $n^n$ is a perfect square, without a calculator?

The actual question is: "how many integers between $1$ and $100$ inclusive, raised to their own power, are perfect squares?".

It is clear that if $n$ is an even number then, $n$ to power $n$ is surely a perfect square.

Now consider the case that n is an odd number. Let us do prime power factorization of n.

$$\text{so }n = a_1^{p_1} \times a_2^{p_2} \times a_3^{p_3} \cdots \times a_k^{p_k}$$.

Where, $a_1,a_2,\cdots,a_k$ are primes and $p_1,p_2,\cdots,p_k$ are maximum power of the corresponding prime present in $n$.

Now,

$$n^n = a_1^{p_1 \times n} \times a_2^{p_2 \times n} \times a_3^{p_3 \times n} \times a_k^{p_k \times n}$$

Now, we just have to use the fact that a number is a perfect square, iff all the powers in its prime-power-factorization are even numbers.

This suggests that all of $(p_1 \times n), (p_2 \times n), (p_3 \times n),\cdots, (p_k \times n)$ must be even to make $n^n$ a perfect square.

However, $n$ is an odd number as per our initial assumption. So it is clear that all of $p_1, p_2, p_3, \cdots, p_k$ must be even. (Since odd$\times$odd cannot be even).

But $p_1,p_2,p_3,\cdots,p_k$ are the powers of prime-power-factorization of $n$. Since these are all even, it suggests that $n$ must also be a perfect square.

So, $n^n$ is a perfect square iff $n$ is even or $n$ itself is a perfect square.

For $n$ from $1$ to $100$ inclusive, there are $50$ even numbers. And $1, 9, 25, 49, 81$ are the five odd numbers which are perfect squares.

Hence, the answer is $55$.

• +1,neat explanation. I have introduced the latex formatting and changed the ambiguous $n$ to $k$ in the prime-factorization. Thanks. Commented Dec 6, 2011 at 18:37

Here are some hints:

1) Any number raised to any even (positive integer) power is a perfect square: $a^{2b} = (a^b)^2$.

2) Any perfect square raised to any (positive integer) power is a perfect square: $(a^2)^b = a^{2b} = (a^b)^2$.

3) The first two hints suggest that you should consider separately the cases in which $n$ is odd and $n$ is even.

'$n^n$ is a perfect square' means that Square root of this number is a whole number. Let me solve this for both case of even and odd numbers as suggested by @pete:

If $n$ is an even number, then we may replace $n$ by $2m \ \forall m=1,2 \ldots$; and thus can write $n^n$ as ${(2m)}^{2m}$.Therefore, $\sqrt {{(2m)}^{2m}} = {(2m)}^m$ which is a whole number.

Similarly, if $n$ is odd, then we can adjust $n$ by $2m+1 \ \forall m=0,1,2 \ldots$; and $\sqrt{{(2m+1)}^{2m+1}} = {(2m+1)}^{m+\frac{1}{2}} ={(2m+1)}^m \times \sqrt{2m+1}$ which is a whole number iff $n=2m+1$ is already a perfect square.

• This seems to be slightly complicated way to repeating what @Pete L. Clark alluded. Commented Dec 6, 2011 at 13:21
• When $n$ is odd, I fail to see why $n^m\sqrt{n}$ being a whole number implies that $n$ is a square. A priori, this only implies that $\sqrt{n}=k/n^m$ with $k$ integer, that is, that $\sqrt{n}$ is a rational number. An additional argument is needed to deduce from this that $\sqrt{n}$ is a whole number. This can be done, but is not yet.
– Did
Commented Dec 6, 2011 at 13:46
• But we know that n is an integer. Doesn't this mean that $\sqrt n$ is either a whole number or irrational? For non-negative n at least.
– Mike
Commented Dec 6, 2011 at 15:52