Divisor Count Function is Odd Iff Argument is Square

Theorem
Let $\tau: \Z \to \Z$ be the $\tau$ function.

Then $\tau \left({n}\right)$ is odd $n$ is square.

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} \ldots p_r^{k_r}$

Then from Tau Function from Prime Decomposition we have that:
 * $\displaystyle \tau \left({n}\right) = \prod_{i \mathop = 1}^r \left({k_i + 1}\right)$

Sufficient Condition
Let $\tau \left({n}\right)$ be odd.

Then all factors of $\displaystyle \prod_{i \mathop = 1}^r \left({k_i + 1}\right)$ are odd (and of course $\ge 3$).

Therefore all factors of $\displaystyle \prod_{i \mathop = 1}^r \left({k_i}\right)$ are even.

Thus $n = p_1^{2 s_1} p_2^{2 s_2} \ldots p_r^{2 s_r}$ for $r_i = k_i / 2$ for all $i$.

Hence $n = \left({p_1^{s_1} p_2^{s_2} \ldots p_r^{s_r}}\right)^2$ and therefore is square.

Necessary Condition
Now suppose $n$ is square.

The above argument reverses, and we see that all factors of $\displaystyle \prod_{i \mathop = 1}^r \left({k_i + 1}\right)$ are odd.

Hence $\tau \left({n}\right)$ is itself odd.