Let $(a_n)$ be a sequence of real numbers.

Here is the proof for the case $|f(n)| \to \infty$.

Write $$\left\lfloor \frac{n}{|a_k|}\right\rfloor = \frac{n}{|a_k|} - \delta_{k,n},$$

where $0 \leq \delta_{k,n} < 1$. Substituting this into the sum we get

$$\begin{align*}
\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor &= \sum_{k=1}^{n} \left(\frac{n}{a_k} - s_k \delta_{k,n}\right) \\
&= n \sum_{k=1}^{n}\frac{1}{a_k} - \sum_{k=1}^{n} s_k \delta_{k,n}.
\end{align*}$$

We can get a crude bound on the right sum,

$$\left|\sum_{k=1}^{n} s_k \delta_{k,n}\right| \leq \sum_{k=1}^{n} \delta_{k,n} < n,$$

so that

$$\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor = n \sum_{k=1}^{n}\frac{1}{a_k} + O(n).$$

Thus

$$\frac{\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor}{n f(n)} = \frac{\sum_{k=1}^{n} \frac{1}{a_k}}{f(n)} + O\left(\frac{1}{f(n)}\right) \to 1.$$

**Q.E.D.**

**Edit:** Here is the proof of another case. Define $M(n)$ to be the least integer, if it exists, such that $n < |a_k|$ for all $k > M(n)$.

**Proposition.** Suppose that

$0 < C \leq |f(n)|$ for $n$ large enough,

$n/a_n = o(1)$,

$M(n) = o(n)$,

$f(n) \sim b\,f(M(n))$ for some constant $b$.

Then $$\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor \sim n f(n).$$

Note that since $n/a_n \to 0$, $M(n)$ exists and $M(n) \to \infty$.

**Proof.** We define $\delta_{k,n}$ as above. The sum becomes

$$\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor = n \sum_{k=1}^{M(n)}\frac{1}{a_k} - \sum_{k=1}^{M(n)} s_k \delta_{k,n}.$$

We again get a rough bound on the right sum,

$$\left|\sum_{k=1}^{M(n)} s_k \delta_{k,n}\right| < M(n),$$

and so

$$\frac{\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor}{b n f(M(n))} = \frac{\sum_{k=1}^{M(n)} \frac{1}{a_k}}{b f(M(n))} + O\left(\frac{M(n)}{n}\right) \to 1.$$

Thus $$\sum_{k=1}^{n} s_k \left\lfloor \frac{n}{|a_k|}\right\rfloor \sim b n f(M(n)) \sim n f(n).$$

**Q.E.D.**

**Corollary.** Suppose that

$a_n > 0$ for all $n$,

$\sum 1/a_n < \infty$,

$M(n) = o(n)$.

Then $$\sum_{k=1}^{n} \left\lfloor \frac{n}{a_k}\right\rfloor \sim n f(n).$$

We will write "$n$C" to refer to condition $n$ in the corollary, and "$n$P" to refer to condition $n$ in the proposition.

**Proof.** Conditions 1C and 2C imply 2P immediately. Further, we can write $$f(n) = \sum_{k=1}^{\infty} \frac{1}{a_k} + o(1),$$ which implies conditions 1P and 4P.

**Q.E.D.**

As an application of the above corollary, all $p$-series have the desired property. We appeal to the proposition to see that all real geometric series (except $\sum (-1)^n$) also have the desired property. The result is then true for all series which do not converge to $0$ whose convergence may be deduced by comparison with a $p$-series or a geometric series.

**Edit 2:** I just wanted to add to this that there is an interesting result by H. Shapiro which can be thought of as a partial converse to the idea we're discussing here. The result is proved and subsequently used to derive a result on the order of the prime counting function in this paper.

I state only the relevant part here.

**Proposition** (Shapiro)**.** Let $(a_n)$ be a nonnegative sequence such that $$\sum_{k=1}^{n} a_n \left\lfloor\frac{n}{k}\right\rfloor = n \log n + O(n)$$ for all $n \geq 1$. Then $$\sum_{k=1}^{n} \frac{a_k}{k} = \log n + O(1).$$