Distribution of pre-images of the divisor function $\sigma$ If $A\subseteq\mathbb{N}$ is a subset of the positive integers, we let $$\mu^+(A) = \lim\sup_{n\to\infty}\frac{|A\cap\{1,\ldots,n\}|}{n}$$ be the upper density of $A$.
For $n\in\mathbb{N}$ we let $\sigma(n)$ be the number of divisors of $n$, the numbers $1$ and $n$ included.
Do we have $\mu^+\big(\sigma^{-1}(\{k\})\big) = 0$ for all $k\in\mathbb{N}$? If not, what is the value of $\sup\big\{\mu^+\big(\sigma^{-1}(\{k\})\big):k\in\mathbb{N}\big\}$?
 A: Notice that $\sigma(p^{k-1}) = k$ and so the image of $\sigma$ is all of $\mathbb{N}$.
By the way, $\sigma$ is usually used for the sum of divisors function, and it is more standard to use $d$ or $\tau$ for your function.
EDIT: I misread the question. I will use $\tau$ instead of $\sigma$.
I claim that $\mu ^ {+}(\tau^{-1}(\{k\})) = 0$. Take a number $m$ in this set, and let us look at $m$'s prime factorization: $m = p_1^{\alpha_1} p_2^{\alpha_2}\cdots p_r^{\alpha_r}$. Notice that there are finitely many options for the $\alpha_i$ (up to a permutation), because $(\alpha_1 + 1)(\alpha_2 + 1) \cdots (\alpha_r + 1)=k$, so it is enough to show that the upper density of numbers of the form $p_1 ^ {\alpha_1} p_2 ^{\alpha_2} \cdots p_r^{\alpha_r}$ where $r, \alpha_i$ are fixed is zero.
Let us look at numbers in this set that are at most $x$. Then if we fix $p_1$, we need to choose primes $p_2, \cdots p_r$ such that $p_2 ^{\alpha_2} \cdots p_r^{\alpha_r} \leq \frac{x}{p_1 ^{\alpha_1}}$.
By induction we can assume that the amount of numbers of the form $p_2 ^{\alpha_2} \cdots p_r^{\alpha_r}$ which are at most $x$ is $o(x)$, and if $\alpha_1 \geq 2$ then this shows that the amount of numbers of the form $p_1 ^{\alpha_1} p_2 ^{\alpha_2} \cdots p_r^{\alpha_r}$ is $o(x)$ by summing over the options of $p_1$ (and using the fact that $\sum_{p} \frac{1}{p^2} \leq \sum_{n} \frac{1}{n^2}$ converges. Therefore it is enough to solve in this case where all $\alpha_i$ are 1, that is to show that the amount of numbers of the form $p_1 \cdots p_r$ up to $x$ is $o(x)$ (for $r$ fixed).
Fixing $p_1$ we see that $p_2$ can be any prime that is at most $\frac{x}{p_1}$. and then $p_3$ can be anything that is at most $\frac{x}{p_1 p_2}$, ... and $p_r$ is at most $\frac{x}{p_1 p_2 \cdots p_{r-1}}$. So we see that the amount of numbers at most $x$ is
$$\sum_{p_1 \leq x} \sum_{p_2 \leq \frac{x}{p_1}} \cdots \sum_{p_{r-1} \leq \frac{x}{p_1 \cdots p_{r-2}}} \pi (\frac{x}{p_1 \cdots p_{r-1}})$$
From here we can use the simple bound $\pi (x) \leq \frac{cx}{log x}$ for some constant $c$ and see that this sum is small.
A: $\tau(n) \le k$ implies that $n=\prod_{i=1}^j p_i$ with $j\le k$, thus $$\sum_{n=1,\tau(n)\le k}^\infty n^{-s} \le (1+\sum_{p \ prime} p^{-s})^k=\sum_n a_k(n) n^{-s}$$
(a coefficient-wise bound)
$1+\pi(x)=O(x/\log x)=O(\sum_{n\le x} 1/\log n)$ and $x/\log x=O(\pi(x))$ imply that $$f_k(x)=\sum_{n\le x} a_k(n) =\sum_{n\le x} \frac1{\log n}f_{k-1}(x/n)$$ $$=O(\sum_{n\le x} \frac1{\log n} \frac{x/n}{\log x/n}(\log \log x/n)^{k-1})=O(\frac{x (\log\log x)^{k-1}}{\log x})$$
