I've seen a few other threads on here, namely this and this, which mention and discuss the Divisor Summatory Function $D(x)=\sum_{n=1}^x\sigma_0(n)$ for parameters other than $x$. But neither quite fit what I'm looking for: in the first link (and the wikipedia page for $D(x)$), it is noted that $$D(x)=\sum_{k=1}^x\bigg\lfloor\frac{x}{k}\bigg\rfloor=2\sum_{k=1}^u\bigg\lfloor\frac{x}{k}\bigg\rfloor-u^2, u=\lfloor\sqrt x\rfloor$$ Which can compute $D(x)$ in $\mathcal{O}(\sqrt x)$ time. Now suppose I define $D'(x) = \sum_{n=1}^x\sigma_0(kn)$ for some integer $k$. I need to compute this for different values of $k$ in far faster than $\mathcal{O}(x)$ time, but I don't think that formula applies any longer and I can't seem to find or derive anything similar. Any ideas?
EDIT 1: At this rate, I've started moving on from that above expression in favor of fiddling around with the prime powers. If $k$ and $n$ are relatively prime, then clearly $\sigma_0(kn)=\sigma_0(k)\sigma_0(n)$. Suppose $n=p_1^{a_1}p_2^{a_2}...p_n^{a_n}$. I've noticed that if $k=p_i$ is prime, \begin{equation} \begin{split} \sigma_0(kn) & = (a_1+1)(a_2+1)...((a_i+1)+1)...(a_n+1) \\ & = (a_1+1)...(a_{i-1}+1)(a_{i+1}+1)...(a_n+1)+\sigma_0(n) \\ & = \frac{\sigma_0(n)}{p_i^{a_i}}+\sigma_0(n) \\ & = \frac{p_i^{a_i}+1}{p_i^{a_i}}\sigma_0(n) \end{split} \end{equation}
Similarly, if $k=p_i^q$ is a prime power then $\sigma_0(kn)=(p_i^{a_i}+q)p_i^{-a_i}\sigma_0(n)$. The only case I have not put in some terms of $\sigma_0(n)$ are composite factors of $x$, which for $x$ which aren't absolutely enormous are computable in negligible time. All that's needed now is to somehow simplify to lower the number of terms necessary, probably by combining certain cases when $k$ relatively prime to $x$ and/or a prime power somehow. It is here I once again hit a wall.