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?

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}$$
