Problem

Source: http://www.artofproblemsolving.com/Forum/viewtopic.php?f=270

Tags: number theory, greatest common divisor, floor function, modular arithmetic, induction, relatively prime



For every positive integer $n$, define the number of non-empty subsets $\mathcal N\subseteq \{1,\ldots ,n\}$ such that $\gcd(n\in\mathcal N)=1$. Show that $f(n)$ is a perfect square if and only if $n=1$.