Define the number $d_n$ as $$d_n = p_1^2 + p_2^2 + \dots + p_k^2$$ where $p_1, p_2, \dots, p_k$ are the $k$ prime factors of $n$.
For example, $d_{220} = 2^2 + 2^2 + 5^2 + 11^2 = 154$ since $220 = 2 \cdot 2 \cdot 5 \cdot 11$.
The sequence $\mathcal{S}_d$ for which $d_n \le n$ starts $1, 16, 27, 32, 36, \dots$ and is the same as http://oeis.org/A166319.
Is the asymptotic density of this sequence greater than zero? How would you go about to calculate it?
Now, define another sequence $\mathcal{S}_e$, which is the same as $\mathcal{S}_d$, but all members that are "generated" by an arithmetic sequence are removed. For example, 32, 48 and 64 (and all other $16k$) are removed since they are multiples of 16. Does this sequence have an asymptotic density (as $n \to \infty$) greater than zero? If so, can it be calculated?
Footnote: The first 30 numbers of $\mathcal{S}_d$ and $\mathcal{S}_e$:
$$S_d = \{ 1, 16, 24, 27, 32, 36, 40, 45, 48, 54, 60, 64, 72, 75, 80, 81, 84, 90, 96, 100, 105, 108, 112, 120, 125, 126, 128, 135, 140, \dots \}$$
$$S_e = \{ 1, 16, 24, 27, 36, 40, 45, 60, 75, 84, 100, 105, 125, 126, 140, 147, 165, 175, 196, 198, 220, 231, 234, 245, 260, 273, 275, 308, 325, 340, \dots \}$$
The density of such integers is exactly $1 - \log 2$. For the lower bound consider the integers $n$ with $\leq 2\log\log n$ prime factors and that are $n^{1/2 - \varepsilon}$ smooth (i.e all of their prime factors are $< n^{1/2 - \varepsilon}$.. Such integers satisfy the condition $d_n \leq n$ for all large enough $n$. By a theorem of Alladi matwbn.icm.edu.pl/ksiazki/aa/aa49/aa4918.pdf the density of such integers is at least $1 - \log 2 - 100 \varepsilon$. Squeeze $\varepsilon \rightarrow 0$.
For reference, note that the density of integers with $\leq 2 \log\log n$ prime factors is $1$, while the density of integers with all of their prime factors $\leq n^{1/2}$ is $1 - \log 2$ (the $1 - \log 2$ corresponds to Dickman's function evaluated at $2$).
Call the above set of integers $A$. Consider the integers $B$ which are not $n^{1/2}$ smooth (i.e have one prime factor $> n^{1/2}$). The density of $B$ is $\log 2$. In addition $A$ and $B$ are disjoint while the density of their union is $1$. The set $C$ of integers with $d_n \leq n$ contains $A$ and is disjoint from $B$. It follows that $d(A) \leq d(C) \leq 1 - d(B)$. Therefore $d(C) = 1- \log 2$.