Asymptotic density of numbers of the form $p_{1}^{\alpha_{1}^{2}}\cdot p_{2}^{\alpha_{2}^{2}}\cdots p_{k}^{\alpha_{k}^{2}}$ If $n$ is a number of the form $p_{1}^{\alpha_{1}^{2}}\cdot p_{2}^{\alpha_{2}^{2}}\cdots p_{k}^{\alpha_{k}^{2}}$ (OEIS A197680) and $T(x)$ counts how many of these numbers are between $1$ and $x$, what is 
$$
\begin{equation*}
\lim_{x\rightarrow \infty}\frac{T(x)}{x}
\end{equation*}
$$
(the asymptotic density)?
This is related to a previous question of mine.
 A: The asymptotic density is $$\lim_{n\rightarrow \infty} \frac{T(x)}{x}=\prod_p \left(1-\frac{1}{p}\right)\left(1+\frac{1}{p}+\frac{1}{p^4}+\frac{1}{p^9}+\frac{1}{p^{16}}+\cdots\right).$$  Alternatively we can write this as 
$$\prod_p \left(1-\frac{1}{p}\right)\left(1+\sum_{n=1}^\infty \frac{1}{p^{n^2}}\right).$$
A: Eric Naslund's answer reminded me of a formula I once sort-of intuited (see comments), and eventually generalized, of which this is a special case. From what I've read it seems to be a standard heuristic in analytic number theory. I'll start with a preliminary:

$\rm\bf Definition$. Let $f$ be an arithmetic function. Then define the asymptotic average $$\mathbb{E}(f)=\lim_{n\to\infty} \frac{1}{n}\sum_{m=1}^nf(m).$$

The main result in question is one that generalizes the two mentioned formulas:

$\rm\bf Theorem$. Suppose $f$ is multiplicative and its asymptotic average exists. Then $$\mathbb{E}(f)=\prod_{p}\left(1-\frac{1}{p}\right)\left(\sum_{r=0}^\infty \frac{f(p^r)}{p^r}\right). \tag{1}$$

And finally, what I can think of right now for a derivation:

$\rm\bf Justification$. Define $f_x(n)$ to be $f(n')$, where $n'$ is $n$ but with all factors $q^r$ such that $q>x$ taken out of its prime factorization. Now note the proportion of naturals $n$ such that $p^r\|n$ (i.e. $p^r|n$ but $p^{r+1}\not|n$) is $(1-1/p)p^{-r}$: we find this by multiplying the probability a natural is not divisible by $p$ with the probability it is divisible by $p^r$. Then we find $f_x$'s asymptotic average via $$\mathbb{E}(f_x)=\sum_{p|n\Rightarrow p\le x} f(n)\left[\prod_{p|n,\;p^r\|n}\left(1-\frac{1}{p}\right)\frac{1}{p^r}\right] \tag{2}$$ $$=\prod_{p\le x}\left[\left(1-\frac{1}{p}\right)\sum_{r=0}^\infty\frac{f(p^r)}{p^r}\right]. \tag{3}$$ Now take the limit as $x\to\infty$ and we obtain the theorem.

There's a bit of bookkeeping to do, namely showing the decomposition of $\mathbb{E}(f_x)$ in $(2)$ is valid and that $\lim_{x\to\infty}\mathbb{E}(f-f_x)=0$ so that taking the limit is justified. And finally the answer to this question may be computed using this by letting $f$ be the multiplicative function such that $f(p^r)$ for a prime power $p^r$ is $1$ if $r$ is a perfect square and $0$ otherwise.
