I saw this post on Reddit and was quite interested in it. I decided to investigate things on my own for a bit. We’ll start with the statement of the Cauchy Condensation Test.
1 Theorem (Cauchy Condensation Test). Let $\left(a_{n}\right)$ be a decreasing (or an eventually decreasing) sequence of non-negative real numbers. Then, $\sum a_{n}$ converges if and only if $\sum2^{n} a_{2^{n}}$ converges.
The main application, and the point of this post, is the following. Here, we use the notation $f^{k}$ to denote the function that results after $k$ compositions of $f$.
2 Theorem (Generalized $p$-Series Test). For all non-negative integers $k$, let $p=\left(p_{0},p_{1},\ldots,p_{k}\right)$ be a $\left(k+1\right)$-tuple of non-negative real numbers and define $\displaystyle{F_{k}\left(p,n\right)=n^{-p_{0}}\prod_{\ell=1}^{k}\left(\log^{\ell}n\right)^{-p_{\ell}},}$ where the empty product resulting from $k=0$ will give $F_{0}\left(p,n\right) = n^{-p_{0}}$. Then, for all $k\geq 0$, the sum $\sum F_{k}\left(p,n\right)$, which we may call a generalized $p$-series, converges if and only if the first $p_{\ell}\neq 1$ is $\gt 1$.
Before proving this, we prove some lemmas.
3 Lemma. Let $p=\left(1,p_{1},\ldots,p_{k}\right)$ and $k\geq 1$. Then, we have that $2^{n}F_{k}\left(p,2^{n}\right)=F_{k-1}\left(p’,n\log2\right)$ for $n$ large enough so that both sides exist, where $p’=\left(p_{0}’,\ldots,p_{k-1}’\right)=\left(p_{1},\ldots,p_{k}\right)$.
Proof. Since $p_{0}=1$, we have that $$2^{n}F_{k}\left(p,2^{n}\right)=2^{n}\cdot2^{-n}\cdot\prod_{\ell=1}^{k}\left(\log^{\ell}2^{n}\right)^{-p_{\ell}}=$$
$$\left(n\log2\right)^{-p_{1}}\prod_{\ell=2}^{k}\left(\log^{\ell-1}\left(n\log2\right)\right)^{-p_{\ell}}=$$
$$\left(n\log2\right)^{-p_{0}’}\prod_{\ell=1}^{k-1}\left(\log^{\ell}\left(n\log2\right)\right)^{-p_{\ell}’}=F_{k-1}\left(p’,n\log2\right).$$
QED
4 Lemma. For all $k\geq0$, there exists $N>0$ such that $F_{k}\left(p,n\log2\right)\leq \left(\log2\right)^{-\max\left(p\right)} F_{k}\left(p,n\right)$ whenever $n\geq N$, where $\max\left(p\right)=\max\left\{p_{0},\ldots,p_{k}\right\}$.
Proof. Left as an exercise for the reader. QED
Proof of Theorem 2. Since the convergence of a series doesn’t rely on the first finitely many terms, we may assume, where needed, that all series are starting at some $n_{0}$ for which the terms exist and Lemma 4 applies in that context.
Since $\sum F_{k}\left(p,n\right)$ diverges for $p_{0}<1$ by comparison with the Harmonic series, we have that $p_{0}\geq1$ is required. Now, note that $F_{k}\left(p,n\right)\leq F_{0}\left(p,n\right)$ for all $k\geq0$ and $n$ for which both sides are defined, and so $p_{0}>1$ gives convergence of $\sum F_{k}\left(p,n\right)$ by the comparison test when comparing with $\sum F_{0}\left(p,n\right)=\sum n^{-p_{0}}$. Therefore, we must prove that the series converges for $p_{0}=1$ when there is $p_{\ell}>1$ for some $\ell>0$.
We proceed by induction on $k$. For $k=1$, we have $\sum n^{-1}\left(\log n\right)^{-p_{1}}$. Since $\left(F_{k}\left(p,n\right)\right)$ is a decreasing sequence for all $k,p$, we use the Cauchy condensation test, and see that this sum converges if and only if $\sum 2^{n}\cdot2^{-n}\left(\log 2^{n}\right)^{-p_{1}}$ converges. Since $2^{n}\cdot2^{-n}\left(\log 2^{n}\right)^{-p_{1}}=n^{-p_{1}}\log(2)^{-p_{1}},$ the sum converges if and only if $p_{1}>1$, as required.
Now, suppose the result holds for $k$ and let $p=\left(1,p_{1},\ldots,p_{k+1}\right)$. Then, by the Cauchy condensation test, we have that $\sum F_{k+1}\left(p,n\right)$ converges if and only if $\sum 2^{n}F_{k+1}\left(p,2^{n}\right)$ converges. By Lemmas 3 and 4, this sum is $\sum F_{k}\left(p’,n\log2\right)\leq \log\left(2\right)^{-\max\left(p’\right)} \sum F_{k}\left(p’,n\right)$, which converges if and only if $p_{0}’>1$ or $p_{0}’=1$ and $p_{\ell}’>1$ for some $\ell>0$ by the induction hypothesis.
Therefore, $\sum F_{k}\left(p,n\right)$ converges if and only if $p_{0}>1$ or $p_{0}=1$ and there is $p_{\ell}>1$ for some $\ell>0$. QED
It doesn’t seem too hard, to me, to generalize slightly further by allowing any $\left(k+1\right)$-tuple of real numbers so that some logarithmic factors $\log^{\ell}$ may occur in the numerator, with convergence if and only if there are logarithmic factors $\log^{\ell’}$ with $\ell’<\ell$ (including $\ell'=0$ for simply the $n$ factor) in the denominator with $p_{\ell'}>1$. I leave this as an exercise for the reader.