Convergence of $ \sum_{n=1}^\infty a_{n}^{-p} $ 
Consider an unbounded sequence $0<a_1<a_2<\cdots$, and set
  $$
s=\limsup_{n\to\infty}\frac{\log n}{\log a_n}.
$$
  Show that the series 
  $$
\sum_{n=1}^\infty a_{n}^{-p}
$$
  converges for $p>s$ and diverges for $p<s$. 


[Attempts.]
When $a_n=n$, this is a well known result about convergence of $p$-series, a proof of which I known from calculus exploits the Cauchy condensation test or the integral test. Since the expression of $a_n$ is unknown in general, I attempted to apply the comparison test and ended up with analyzing 
$
\lim_{n\to\infty}\frac{n^p}{a_n^p}.
$
The quotient $\dfrac{n^p}{a_n^p}$ seems very much relates to $s$. But I'm stuck here for I don't see how the existence of the limit might relate to $p$ and $s$.
 A: Let us prove that the series converges if $p>s$.
Setting $\epsilon := (p-s)/2 > 0$, there exists $N \in \mathbb{N}$ such that
$$
\frac{\log n}{\log a_n} < p-\epsilon,
\qquad \forall n\geq N,
$$
hence
$$
\frac{1}{a_n^p} \leq \frac{1}{n^{p/(p-\epsilon)}},
\qquad \forall n\geq N.
$$
Since $q := \frac{p}{p-\epsilon} > 1$, the series $\sum a_n^{-p}$ converges by comparison with $\sum n^{-q}$.
Consider now the case $p < s$. Clearly, we can assume that $p > 0$.
By definition of limsup, there exists a subsequence $(n_j)$ such that
$$
\frac{\log n_j}{\log a_{n_j}} > p
\qquad \forall j,
$$
i.e.
$$
\frac{1}{a_{n_j}^p} > \frac{1}{n_j}
\qquad \forall j.
$$
Since the sequence $a_{n_j}^{-p}$ is monotonically decreasing to $0$, setting $n_0 := 0$ we have that
$$
\sum_{n=1}^\infty a_n^{-p} =
\sum_{j=1}^\infty \sum_{k= n_{j-1} + 1}^{n_j} a_k^{-p}
\geq \sum_{j=1}^\infty (n_j - n_{j-1}) a_{n_j}^{-p}
\geq \sum_{j=1}^\infty \frac{n_j - n_{j-1}}{n_j}\,.
$$ 
On the other hand, the series at r.h.s. diverges to $+\infty$ (as proved in the lemma below), hence also $\sum a_n^{-p}$ diverges by comparison.
LEMMA. Let $(x_j)$ be an increasing sequence of positive numbers diverging to $+\infty$. Then the series $\sum_{j=2}^\infty (x_j - x_{j-1})/x_{j-1}$ diverges to $+\infty$.
As a consequence, also the series $\sum_{j=2}^\infty (x_j - x_{j-1})/x_{j}$
diverges to $+\infty$.
Proof. Let $f\colon [1, +\infty) \to [0,+\infty)$ be the piecewise affine function (affine on each interval $[j-1, j]$) such that $f(j) = x_j$. Then $g(x) := \log f(x)$ is piecewise $C^1$ and 
$$
g'(x) = \frac{f'(x)}{f(x)} \leq \frac{x_j - x_{j-1}}{x_{j-1}}
\qquad \forall x\in (j-1, j).
$$
Hence, for every $N\in\mathbb{N}$,
$$
\sum_{j=2}^N \frac{x_j - x_{j-1}}{x_{j-1}} \geq \sum_{j=2}^N\int_{j-1}^j g'(x)\, dx
= g(N) - g(1)
$$
and the result follows since 
$$
\lim_{N\to +\infty} g(N) = \lim_{N\to +\infty} \log x_N = +\infty.
$$
For the last part it is enough to observe that it is enough to consider the case $\lim_j (x_j - x_{j-1})/x_j = 0$ (for otherwise the series is certainly divergent), i.e. $\lim x_{j-1} / x_j = 1$.
