Moments of number of interval restricted divisors I have previously asked the question A truncated divisor function sum
where the sum
$$
S_f(x)=\sum_{n\leq x} \min\{f(x),d(n)\}\quad (1)
$$
was of interest, and it was answered satisfactorily.
Here, I am interested in estimating the following quantity
$$
S_a(x,m)=\sum_{n\leq x} \#\{d: d|n~\mathrm{and}~d\leq m\}^a
$$
so the divisors are restricted in size, or restricted to the interval $[1,m]$ not in ``number'' as in (1).
When $a=1,$ this is straightforward (as far as obtaining the main term), since the sum can be evaluated horizontally
$$
S_1(x,m)=\sum_{d\leq m} \lfloor x/d \rfloor=\left[\sum_{d\leq m} \frac{x}{d}\right]+O(m)=x \log m + O(m),
$$
and typically I'd be interested in relatively small values of $m$ in terms of $x$.
What about $a\neq 1$? In particular, $a=1/2,$ or $a=2,3,$ etc. How can one estimate those sums?
 A: We assume $m\leq x$.  Your $S_1(x,m)$ is in fact, $x\log m + O(m)$.
This answer finds an estimate of $S_2(x,m)$.
$$
\begin{align}
S_2(x,m)&=\sum_{n\leq x} \left(\sum_{d|n, d\leq m} 1 \right)^2=\sum_{d_1\leq m, d_2\leq m} \sum_{n\leq x, [d_1,d_2]|n}1\\
&=\sum_{d_1\leq m, d_2\leq m} \frac x{[d_1,d_2]}+O(m^2),
\end{align}
$$
where $[d,u]=\mathrm{lcm}(d,u)$.
To find an estimate of the first sum, let  $[d_1,d_2]=d_1d_2/(d_1,d_2)$ where $d=(d_1,d_2)=\mathrm{gcd}(d_1,d_2)$, we write $d_1=dk$, $d_2=dl$ with $(k,l)=1$. To establish $(k,l)=1$, we use the identity $\sum_{d|n}\mu(d) = \delta_1(n)$, where $\delta_1(n)=1$ when $n=1$, $0$ otherwise.   Then $k=uv$, $l=uw$, so that $d_1=duv$, $d_2=duw$, $[d_1,d_2]=dkl=du^2vw$.  Then
$$
\begin{align}
\sum_{d_1\leq m, d_2\leq m} \frac1{[d_1,d_2]}&= \sum_{duv\leq m, duw\leq m} \frac{\mu(u)}{du^2vw} \\
&=\sum_{u\leq m}\sum_{d\leq m/u} \frac{\mu(u)}{du^2} \sum_{v\leq m/du, w\leq m/du} \frac1{vw} \\
&=\sum_{u\leq m}\sum_{d\leq m/u} \frac{\mu(u)}{du^2} \left( \log^2(m/du) + O(\log m)\right)\\
&=\sum_{u\leq m}\sum_{d\leq m/u}\frac{\mu(u)}{du^2}\left(\log^2m-2\log m\log du+\log^2 du\right)\\
&=\frac1{\zeta(2)}\log^3 m-\frac1{\zeta(2)}\log^3m + \frac1{3\zeta(2)}\log^3m + O(\log^2m)\\
&=\frac1{3\zeta(2)}\log^3m+O(\log^2m)\\
&=\frac2{\pi^2}\log^3m + O(\log^2m).
\end{align}
$$
Hence,
$$
S_2(x,m)=\frac{2x}{\pi^2}\log^3m + O(x\log^2m)+O(m^2).
$$
We might be able to obtain $S_a(x,m)$ by the same method. But, resulting sums are more complicated.
