The totient function of an integer $n$ with prime factorisation $\prod \limits_{k=1}^r p_k^{\alpha_k}$ is given by $\varphi(n) = \prod \limits_{k=1}^r p_k^{\alpha_k-1}(p_k-1)$. This allows you to determine the totient based off a prime factorisation, and furthermore also tells you that $n$ cannot have a square factor since if $p^2$ divides $n$ then $p$ divides $\varphi(n)$, and so we now have $\varphi(n) = \prod \limits_{k=1}^r (p_k-1)$ where $n$ is a product of distinct primes.