Divisor Count of Square-Free Integer is Power of 2

Theorem
Let $n$ be a square-free integer.

Let $\tau: \Z \to \Z$ be the divisor counting Function.

Then $\map \tau n = 2^r$ for some $r \ge 1$.

The converse is not true in general.

That is, if $\map \tau n = 2^r$ for some $r \ge 1$, it is not necessarily the case that $n$ is square-free.

Proof
Let $n$ be an integer such that $n \ge 2$.

Let the prime decomposition of $n$ be:
 * $n = p_1^{k_1} p_2^{k_2} \dotsm p_r^{k_r}$

Then from Divisor Counting Function from Prime Decomposition we have that:
 * $\ds \map \tau n = \prod_{i \mathop = 1}^r \paren {k_i + 1}$

Let $n$ be square-free.

Then by definition:
 * $\forall i: 1 \le i \le r: k_i = 1$

So:
 * $\ds \map \tau n = \prod_{i \mathop = 1}^r \paren {1 + 1} = 2^r$

The statement about the converse is proved by counterexample:

Let $n = p^3$ where $p$ is prime.

Then $n$ is not square-free as $p^2 \divides n$.

However:
 * $\map \tau n = 3 + 1 = 2^2$