Interesting sequence in size of coprime equivalence classes In the course of computation for a Project Euler problem, I was testing a function and noticed a strange pattern.
Take the natural numbers $\{2 , 3 , \dots n\}$. Call $a \sim b$ iff all natural numbers coprime to $a$ are also coprime to $b$ and vice-versa. This is the same as saying that they have the same prime factorisation if we ignore the exponents.
Call $f(n)$ the number of equivalence classes
$$f(n) = \left|(\{2,3,\dots n\}/\sim) \right|$$
Example for n = 10: The equivalence classes are $\{\{2,4,8\},\{3,9\},\{6\},\{5\},\{7\},\{10\}\}$
Example for n = 20: The equivalence classes are $\{\{2,4,8,16\},\{3,9\},\{6,12,18\},\{5\},\{10,20\},\{7\},\{11\},\{13\},\{14\},\{15\},\{17\},\{19\}\}$
Here are some sample values for $f$ for powers of $10$:
$$\begin{align}
f(10) &= 6 \\
f(100) &= 60 \\
f(1000) &= 607 \\
f(10000) &= 6082 \\
f(100000) &= 60793 \\
f(1000000) &= 607925
\end{align}$$
Call me superstitious, but this looks like a pattern. In fact, it looks like the decimal expansion of $6/\pi^2$.

Does anyone know if there's a genuine pattern here, and why?
 A: Another way to think of $f(n)$ is as the number of squarefree numbers below $n$, since there is exactly one squarefree number in each of the equivalence classes you describe, and squarefree number is the smallest element of each class. Thus, $f(n)/n$ is the fraction of numbers under $n$ which are squarefree.
For a given prime $p$, as $n$ goes to infinity, $1-1/p^2$ of the numbers below $n$ are not divisible by $p^2$. Informally, the fraction of numbers below $n$ not divisible by the square of any prime should be about
$$ \prod_{p} (1 - p^{-2}) = \left(\prod_{p} \frac{1}{1 - p^{-2}} \right)^{-1} = \frac{1}{\zeta(2)} = \frac{6}{\pi^2}$$
A: The answer by @BoltonBailey explains it very well. I'll just add some trivial details about the computation. In fact, $n$ is square-free iff $\mu(n)\not=0$, i.e., $(\mu(n))^2=1$. So $f(n)/n$ evaluates to
\begin{align}\frac{f(n)}n & =\frac 1 n \sum_{i\leq n}(\mu(i))^2\\
& = \frac 1 n\sum_{i\leq n}\sum_{d^2\mid i}\mu(d)\\
& =\frac 1 n\sum_{d\leq\sqrt n}\mu(d)\left(\frac{n}{d^2}+O(1)\right)\\
& =\sum_{d\leq\sqrt n}\frac{\mu(d)}{d^2}+O(n^{-1/2})\\
& =\frac 1 {\zeta(2)}+O(n^{-1/2})\end{align}
A: Welp, perhaps I should have deleted my question instead, as I soon saw this quote on the OEIS (Online Encyclopedia of Integer Sequences):

$6/\pi^2$ is the probability that two randomly selected numbers will be coprime

However, this still leaves the question of why.
