Is there a nice closed-form expression for, or asymptotic formula for the number of numbers below $n$ with a square number of distinct prime factors?
Motivation:
As a student who studies mathematics in my spare time, I encountered some questions asking about the number of numbers below certain limits that adhere to certain elementary factor properties and later was thinking about it, when it occurred to me that there were many, seemingly simple or natural, questions to ask about "counting functions" that nothing I know can help with...
So, more generally, on top of an answer to the above, are there nice toolkits or pieces of machinery that can, with some property, tell me the number of numbers below $n$ with that property? (even if this toolkit only works for a specific subset of properties, I would be interested)
Let $\pi_k(n)$ be the number of integers $\le n$ with exactly $k$ distinct prime factors. You are looking for $\sum_{m=1}^{\infty}\pi_{m^2}(n)=\pi(n)+\pi_4(n)+\pi_9(n)+\ldots$. Hardy and Ramanujan proved the upper bound $$ \pi_k(n) < c(n/\log n) \cdot (\log\log n + d)^{k-1}/(k-1)!$$ for some constants $c$ and $d$, and Erdös and Pillai (independently) proved the lower bound $$ \pi_k(n) > c'(n/\log n) \cdot (\log\log n)^{k-1}/(k-1)! $$ for some constant $c'$. So, putting things together, you have $$ \frac{c'(\log\log n)^{k-1}}{(k-1)!}<\frac{\pi_{k}(n)}{n/\log n}<\frac{c(\log\log n+d)^{k-1}}{(k-1)!}. $$ Taking $g(z)=\sum_{m=1}^{\infty}\frac{z^{m^2-1}}{(m^2-1)!}$, you have $$ c'g(\log \log n)<\frac{\sum_{m=1}^{\infty}\pi_{m^2}(n)}{n/\log n}<cg(\log\log n + d). $$ Update:
After spending some time looking into the asymptotic growth of functions like $g(z)$, analytic with every derivative at the origin equalling zero or one... which seems interesting and may be worth its own question... I think that $g(z)$ is $\Theta(e^z / \sqrt{z})$ for large $z$. If that's correct, then in fact $$ \sum_{m=1}^{\infty}\pi_{m^2}(n)\in\Theta\left(\frac{n}{\sqrt{\log\log n}}\right). $$