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 tau function.

Then $$\tau \left({n}\right) = 2^r$$ for some $$r \ge 1$$.

The converse is not true in general.

That is, if $$\tau \left({n}\right) = 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$$, with prime decomposition $$n = p_1^{k_1} p_2^{k_2} \ldots p_r^{k_r}$$.

Then from Tau Function - Number of Positive Divisors we have that $$\tau \left({n}\right) = \prod_{i=1}^r \left({k_i + 1}\right)$$.


 * Let $$n$$ be square-free.

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

So $$\tau \left({n}\right) = \prod_{i=1}^r \left({1 + 1}\right) = 2^r$$.


 * Now let $$n = p^3$$ where $$p$$ is prime.

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

However, $$\tau \left({n}\right) = 3 + 1 = 2^2$$.