  Let $S(t) = \tfrac{1}{\pi} \arg \zeta (\frac12 + it)$ be the argument of the
Riemann zeta-function at the point $\tfrac12 + it$. For $n \geq 1$ and $t>0$
define its iterates \begin{equation*} S_n(t) = \int_0^t S_{n-1}(\tau) \,{\rm
d}\tau\, + \delta_n\,, \end{equation*} where $\delta_n$ is a specific constant
depending on $n$ and $S_0(t) := S(t)$. In 1924, J. E. Littlewood proved, under
the Riemann hypothesis (RH), that $S_n(t) = O(\log t/ (\log \log t)^{n+1})$.
The order of magnitude of this estimate was never improved up to this date. The
best bounds for $S(t)$ and $S_1(t)$ are currently due to Carneiro, Chandee and
Milinovich. In this paper we establish, under RH, an explicit form of this
estimate \begin{equation*} -\left( C^-_n + o(1)\right) \frac{\log t}{(\log \log
t)^{n+1}} \ \leq \ S_n(t) \ \leq \ \left( C^+_n + o(1)\right) \frac{\log
t}{(\log \log t)^{n+1}}\,, \end{equation*} for all $n\geq 2$, with the
constants $C_n^{\pm}$ decaying exponentially fast as $n \to \infty$. This
improves (for all $n \geq 2$) a result of Wakasa, who had previously obtained
such bounds with constants tending to a stationary value when $n \to \infty$.
Our method uses special extremal functions of exponential type derived from the
Gaussian subordination framework of Carneiro, Littmann and Vaaler for the cases
when $n$ is odd, and an optimized interpolation argument for the cases when $n$
is even. In the final section we extend these results to a general class of
$L$-functions.
