1 Introduction and statement of results

1.1 Dyson’s rank

In his attempt to find a combinatorial interpretation of the famous congruences

discovered by Ramanujan [22] for p(n) , the number of partitions of n,  Dyson [15] introduced the rank of a partition, often referred to as Dyson’s rank, which is defined to be the largest part of the partition minus the number of its parts. As shown by Atkin and Swinnerton-Dyer [6], the rank would indeed explain the congruences modulo 5 and 7, but not those modulo 11. To justify the latter congruences, Dyson conjectured the existence of another partition statistic, called the crank. Some forty years later, Andrews and Garvan [2] found the right definition of the crank and proved that it simultaneously explains all the three congruences. Dyson [15] conjectured that the rank is equidistributed modulo 5 and 7, i.e., that for \( 0\le s\le 4 \) and \( 0\le t\le 6 \) we have

$$\begin{aligned} N(s,5,5n+4)&=\frac{p(5n+4)}{5},\\ N(t,7,7n+5)&=\frac{p(7n+5)}{7}, \end{aligned}$$

where N(acn) denotes the number of partitions of n with rank congruent to a modulo c. Atkin and Swinnerton-Dyer [6] proved this claim by computing for \( \ell \in \{5,7\}\) the generating functions associated to every rank difference \( N(s,\ell ,\ell n+d)-N(t,\ell , \ell n+d), \) with \( 0\le d,s,t<\ell . \) While many of these turned out to be non-trivially zero, others were shown to be infinite products or generalized Lambert series related to Ramanujan’s third order mock theta functions. Analogous, yet more technical formulas were found by Atkin and Hussain [5] for \( \ell =11. \)

It is not surprising that this generated a great amount of interest in studying rank differences and rank inequalities for other moduli. In this regard, we have the inequalities

found in [3] and [19] by Andrews and Lewis, who also conjectured that

(1)

Bringmann [7] proved that the inequalities stated in (1) are indeed valid for all values of n except \( n\in \{3,9,21\}, \) in which cases equality holds. Further, Bringmann and Kane [8] proved that, for any odd \( c>9 \) and for \( 0\le a<b\le \frac{c-1}{2}, \) we have

$$\begin{aligned} N(a,c,n)>N(b,c,n) \end{aligned}$$

for n large enough. They also studied the sign of the rank differences \( N(a,c,n)-N(b,c,n) \) for the moduli \( c=5,7 \) and 9, showing that this depends on the residue class of n modulo c.

1.2 Overpartitions

By an overpartition of n we mean a partition in which the first occurrence of a part may (or may not) be overlined, and by \( \overline{p}(n) \) we denote the number of overpartitions of n. To illustrate with an example, we have \( p(4)=5, \) since the partitions of 4 are given by

$$\begin{aligned} 4,~3+1,~2+2,~2+1+1,~1+1+1+1, \end{aligned}$$

whereas \( \overline{p}(4)=14, \) since the overpartitions of 4 are

$$\begin{aligned}&4,~\overline{4},~3 + 1,~\overline{3}+ 1,~3 +\overline{1},~\overline{3} + \overline{1},~2+ 2,~\overline{2} + 2,~2+ 1+1,\\&\quad \overline{2} + 1 + 1,~2+ \overline{1} + 1,~\overline{2} +\overline{1} + 1, 1+1 + 1 + 1,~\overline{1}+1 + 1 + 1. \end{aligned}$$

The rank (also called D-rank) of an overpartition is defined in exactly the same way as for partitions. We denote by \( \overline{N}(m,n) \) the number of overpartitions of n with rank m,  and by \( \overline{N}(a,c,n) \) the number of overpartitions of n with rank congruent to a modulo c.

As opposed to Ramanujan’s congruences for the partition function, in the case of overpartitions there are no congruences of the form for primes \( \ell \ge 3. \) Therefore, the rank differences \(\overline{N}(s,\ell ,\ell n+d)-\overline{N}(t,\ell ,\ell n+d)\) provide a measure of the extent to which the rank fails to produce such a congruence. As such, trying to find the associated generating functions and, whenever possible, the sign of these rank differences and the resulting inequalities, has turned into a vivid area of recent research.

1.3 Motivation

Lovejoy and Osburn [21] found formulas for the rank differences \(\overline{N}(s,\ell ,\ell n+d)-\overline{N}(t,\ell ,\ell n+d)\) in terms of modular functions and generalized Lambert series for \( \ell =3 \) and \( \ell =5, \) whereas Jennings-Shaffer [17] computed the rank differences for \( \ell =7 \) using the result of Bringmann and Lovejoy [9] that the overpartition rank function is the holomorphic part of a harmonic Maass form. More recently, Cui, Gu and Su [14] computed the rank differences for \( \ell =4 \) and \( \ell =8, \) obtaining a few identities and inequalities that were also independently formulated and proven in the current paper, while Ji, Zhang and Zhao [18], and Wei and Zhang [23] computed the rank differences for \( \ell =6 \) and \( \ell =10 \) by relating them to Ramanujan’s third and tenth order mock theta functions. They also established a few inequalities and left several others as conjectures, all of which were subsequently proven, with different methods, by the author [10]. Some of them are simple inequalities between ranks, similar to (1), such as

while others involve sums of ranks, e.g.,

$$\begin{aligned} \overline{N}(0,6,n)+\overline{N}(1,6,n)&> \overline{N}(2,6,n)+\overline{N}(3,6,n),\\ \overline{N}(0,10,n)+\overline{N}(1,10,n)&> \overline{N}(4,10,n)+\overline{N}(5,10,n). \end{aligned}$$

1.4 Main results

To the best of our knowledge, no such inequalities have been found for moduli other than \( \ell \in \{6,10 \}\) and, in some particular cases, \( \ell \in \{4,8\}. \) In this paper we give a complete characterization, for all moduli \( c\ge 2, \) of the inequalities of the form

$$\begin{aligned} \overline{N}(a,c,n)>\overline{N}(b,c,n), \end{aligned}$$
(2)

with \( 0\le a<b\le \left\lfloor \frac{c}{2}\right\rfloor . \) In light of the fact that \( \overline{N}(a,c,n)=\overline{N}(c-a,c,n), \) property which can be easily deduced from \( \overline{N}(m,n)=\overline{N}(-m,n) \) (see, e.g., [20, Proposition 1.1]), it is enough to restrict our attention to the case when \( 0\le a<b\le \left\lfloor \frac{c}{2}\right\rfloor , \) and this is why we will indeed work under this assumption.

This is partly inspired by the results of Bringmann and Kane [8] on inequalities between partition ranks, and comes to complete the work initiated in [10] by the author. In contrast to [8] however, where only the case \( 2\not \mid c \) was dealt with for partition ranks N(acn) , here we are also able to treat the case when c is even.

As we will see in Theorem 1, the inequality (2) holds for all \( c\ge 7 \) and n large enough, while for \( 2\le c\le 5,\) the only cases that were not treated by now and which we study in Theorems 25, the sign of the inequality changes with the residue class of n modulo c. In addition to the inequalities, we prove that some interesting results hold for \( c\in \{2,4\}. \)

If one might perhaps expect that the higher moduli are influenced by their smallest prime divisors, which would then determine the sign of the rank difference, we will show that this is not the case and we will explain the reason for which the inequalities are not affected by the residue class modulo c for \( c\ge 7 \) and n large enough. More precisely, we prove the following.

Theorem 1

If \( c\ge 7, \) there exists \( n_{a,b,c} \) depending on abc such that

$$\begin{aligned} \overline{N}(a,c,n)>\overline{N}(b,c,n) \end{aligned}$$

for \( 0\le a<b\le \left\lfloor \frac{c}{2}\right\rfloor \) and for any \(n>n_{a,b,c}.\)

For the only moduli left to study, namely \( c\in \{ 2,3,4,5\}, \) we prove that the following results hold. The reader interested in the inequalities and identities proven for \( c= 6 \) can consult [10] and [18].

Theorem 2

For \(n\ge 41\) we have

The values \( n\le 40 \) for which the inequalities stated in Theorem 2 do not hold are given in the following table, accompanied by the corresponding exceptions.

Table 1 Exceptions for \( c=5 \)

Theorem 3

For \( n\ge 1 \) we have

$$\begin{aligned} \overline{N}(0,2,n)&>\overline{N}(1,2,n)~ \quad \text {if}~n~\text {is odd},\\ \overline{N}(0,2,n)&<\overline{N}(1,2,n)~ \quad \text {if}~n \text { is even}. \end{aligned}$$

Theorem 4

For \( n\ge 1 \) we have

By computing rank differences for \( \ell =4 \) and \( \ell =8 \), Cui, Gu and Su [14] established very recentlyFootnote 1 a few identities and inequalities, see Theorems 1.2–1.5 in [14], most of which also follow from Theorem 1 and the next result. However, while Theorem 1.5 in [14] gives several inequalities that hold modulo 8 for n in certain residue classes, it does not capture the full behavior of the inequalities. This is answered by Theorem 1 of the current paper, applied to the case \( c=8. \)

Theorem 5

For \( n\ge 1 \) we have

$$\begin{aligned} \overline{N}(0,4,n)&>\overline{N}(1,4,n)~ \quad \text {if}~n~\text {is odd},\\ \overline{N}(0,4,n)&<\overline{N}(1,4,n)~\quad \text {if}~n~\text {is even}, \\ \overline{N}(1,4,n)&<\overline{N}(2,4,n)~ \quad \text {if}~n~\text {is odd},\\ \overline{N}(1,4,n)&>\overline{N}(2,4,n)~ \quad \text {if}~n~\text {is even},\\ \end{aligned}$$

and

$$\begin{aligned} \overline{N}(0,4,n)-\overline{N}(2,4,n)={\left\{ \begin{array}{ll} 0 &{} \text {if}~n\text { is not a square},\\ 2 &{} \text {if}~n\text { is a square.}\end{array}\right. } \end{aligned}$$

Remark 1

The number \( n_{a,b,c} \) depends only on abc and can be found after a finite computation. We will make this precise in Sect. 4.

Remark 2

The inequalities from Theorems 1, 2 and 4 also shed light on the signs of the coefficients of the rank differences found for \( \ell \in \{3,4,5,7,8\} \) in [14, 17] and [21]. A study of rank inequalities based on q-series expansions was done in [18] for \(\ell \in \{6,10\}, \) but this was only possible in the case of some fairly simple expressions for which it is not difficult to conclude, say, that the coefficients are all positive (see, e.g., the proof of [18, Theorem 1.4]). However, this is also the reason for which other inequalities cannot be proven with that approach. For \( \ell \in \{3,4,5,7,8\}, \) the rank differences are written as sums of various quotients of infinite products, and the sign of the coefficients of these rather complicated q-series expansions (see Theorems 1.3–1.4 of [14], Theorem 1.1 of [17], or Theorems 1.1–1.2 in [21]) can generally not be guessed a priori.

Remark 3

The identity \( \overline{N}(0,5,n)=\overline{N}(2,5,n) \) for does not follow from our theorem, but it was already proven by Lovejoy and Osburn, see eq. (12) from [21, Theorem 1.2]. Nevertheless, we include it here for completeness.

Remark 4

There is no way to deduce any of the inequalities listed in Theorem 2 simply by adding, say, the inequalities between ranks modulo 10 obtained in [10, Theorem 2]. In fact, this is impossible, in general, precisely because of (2) and the fact that \( \overline{N}(a,c,n)=\overline{N}(c-a,c,n). \)

Remark 5

Theorem 3 shows that the sign of the rank difference \( \overline{N}(0,2,n)-\overline{N}(1,2,n) \) alternates with the parity of n. A similar result holds (see [11] and [12]) for \( p_r(0,2,n)-p_r(1,2,n), \) where \( p_r(a,m,n) \) denotes the number of partitions of n into r-th powers that have a number of parts congruent to a modulo m.

1.5 Overview

Our work relies heavily on the results established in [10], and the general approach that we follow is, to some extent, similar to what was done in the case of partition ranks by Bringmann and Kane [8]. Therefore, although the current paper is self-contained and may be read independently, the reader is warmly invited to consult these two references.

The paper is structured as follows. In Sect. 3 we describe the main ideas of the proof of Theorem 1, which we give in Sect. 4, together with the proofs of Theorems 25. In order to explain the general strategy, we need to introduce some notation and recall the results of [10], and this we do in Sect. 2.

2 Preliminaries

2.1 Rank generating functions

Before being able to fully explain our approach, we need a few preparatory steps. We begin by recalling that, if \( q=e^{2\pi iz}, \) with \( z\in \mathbb {C}\) and \({{\,\mathrm{Im}\,}}(z)>0, \) the overpartition generating function (see, e.g., [13]) is given by

$$\begin{aligned} \overline{P}(q):=\sum _{n\ge 0}\overline{p}(n)q^n=\frac{\eta (2z)}{\eta ^2(z)}=\prod _{n=1}^{\infty }\frac{1+q^n}{1-q^n}=1+2q+4q^2+8q^3+14q^4+\cdots , \end{aligned}$$

where

$$\begin{aligned} \eta (z):=q^{\frac{1}{24}}\prod _{n=1}^{\infty }(1-q^n) \end{aligned}$$

stands, as usual, for the Dedekind eta function. Further, we know from [20] that

$$\begin{aligned} \mathcal {O}(u;q):=&\sum _{n=0}^{\infty }\sum _{m=-\infty }^{\infty }\overline{N}(m,n)u^mq^n =1+\sum _{n=1}^{\infty }\frac{(-1)_nq^{\frac{1}{2}n(n+1)}}{(uq,q/u)_n}\\&=\frac{(-q)_{\infty }}{(q)_{\infty }}\left( 1+2\sum _{n\ge 1}\frac{(1-u)(1-u^{-1})(-1)^nq^{n^2+n}}{(1-uq^n)(1-u^{-1}q^n)} \right) , \end{aligned}$$

where for \( a,b\in \mathbb {C}\) and \( n\in \mathbb {N}\cup \{\infty \} \) we use the q-Pochhammer symbols

$$\begin{aligned} (a)_n&:=\prod _{r=0}^{n-1}(1-aq^r),\\ (a,b)_n&:=\prod _{r=0}^{n-1}(1-aq^r)(1-bq^r). \end{aligned}$$

For \( 0<a<c \) coprime positive integers and \( \zeta _n=e^{\frac{2\pi i}{n}} \) the standard primitive n-th root of unity, let

$$\begin{aligned} \mathcal {O} \left( \frac{a}{c};q\right) :=\mathcal {O} \left( \zeta _c^a;q \right) =\sum _{n=0}^{\infty } A\left( \frac{a}{c};n \right) q^n. \end{aligned}$$

The letters h and k will denote coprime positive integers throughout, with \( 0\le h<k. \) If \( k=1, \) we set \( h=0, \) this being the only instance when \( h=0 \) is allowed. Let \( \widetilde{k}=0 \) if k is even, and \( \widetilde{k}=1 \) if k is odd, and put \( k_1=\frac{k}{(c,k)}, \) \( c_1=\frac{c}{(c,k)}. \) Further, let \( 0\le \ell <c_1 \) and \( h'\in \mathbb {Z} \) be given by the congruences , respectively .

Remark 6

From the fact that \( \overline{N}(m,n)=\overline{N}(-m,n) \) it easily follows that the coefficients \( A\left( \frac{a}{c};q \right) \) are real.

2.2 Kloosterman sums

Recall that if

$$\begin{aligned} ((x)):={\left\{ \begin{array}{ll} x-\lfloor x\rfloor -\frac{1}{2} &{} \text {if}~x\in \mathbb {R}\setminus \mathbb {Z},\\ 0 &{} \text {if}~x\in \mathbb {Z}, \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} S_{h,k}:=\sum _{\mu =0}^{k-1}\left( \left( \frac{\mu }{k}\right) \right) \left( \left( \frac{h\mu }{k} \right) \right) \end{aligned}$$

is the so-called Dedekind sum, then

$$\begin{aligned} \omega _{h,k}:=\exp ( \pi i S_{h,k} ) \end{aligned}$$

is the multiplier that appears in the transformation of the partition function; see, e.g., [1, Chapter 5].

In what follows, we will make use of several Kloosterman-type sums, which we define below. Here and throughout, by \( \sum '_h \) we always indicate summation over the integers \( 0\le h<k \) that are coprime to k.

If \( c\mid k, \) let

and

If \( c\not \mid k \) and \( 0<\frac{\ell }{c_1}\le \frac{1}{4},\) let

and if \( c\not \mid k \) and \( \frac{3}{4}<\frac{\ell }{c_1}<1,\) let

Finally, if \( c\not \mid k, \) set

$$\begin{aligned} \delta _{c,k,r}:={\left\{ \begin{array}{ll} \frac{1}{16}-\frac{ \ell }{2c_1}+\frac{\ell ^2}{c_1^2}-r\frac{\ell }{c_1} &{}\text {{if}}~0<\frac{\ell }{c_1}\le \frac{1}{4},\\ 0 &{} \text {if}~\frac{1}{4}<\frac{\ell }{c_1}\le \frac{3}{4},\\ \frac{1}{16}-\frac{3\ell }{2c_1}+\frac{\ell ^2}{c_1^2}+\frac{1}{2}-r\left( 1-\frac{\ell }{c_1} \right) &{} \text {if}~\frac{3}{4}<\frac{\ell }{c_1}<1, \end{array}\right. } \end{aligned}$$

and

$$\begin{aligned} m_{a,c,k,r}:={\left\{ \begin{array}{ll} -\frac{1}{2c_1^2}( 2(ak_1-\ell )^2+c_1(ak_1-\ell ) +2rc_1(ak_1-\ell )) &{}\text {{if~}}0<\frac{\ell }{c_1}\le \frac{1}{4},\\ 0 &{} \text {if}~\frac{1}{4}<\frac{\ell }{c_1}\le \frac{3}{4},\\ -\frac{1}{2c_1^2}( 2(ak_1-\ell )^2 +3c_1(ak_1-\ell )-2rc_1(ak_1-\ell )-c_1^2(2r-1)) &{} \text {if}~\frac{3}{4}<\frac{\ell }{c_1}<1. \end{array}\right. } \end{aligned}$$

2.3 Modular transformations

If \( \frac{b}{c}\in (0,1)\setminus \left\{ \frac{1}{2}\right\} , \) define

$$\begin{aligned} s(b,c):={\left\{ \begin{array}{ll} 0 &{} \text {if}~0<\frac{b}{c}\le \frac{1}{4},\\ 1 &{} \text {if}~\frac{1}{4}<\frac{b}{c}\le \frac{3}{4},\\ 2 &{} \text {if}~\frac{3}{4}<\frac{b}{c}<1, \end{array}\right. } \quad \text {and}\quad t(b,c):={\left\{ \begin{array}{ll} 1 &{} \text {if}~0<\frac{b}{c}<\frac{1}{2},\\ 3 &{} \text {if}~\frac{1}{2}<\frac{b}{c}<1. \end{array}\right. } \end{aligned}$$

For reasons of space, we will write \( s=s(b,c) \) and \( t=t(b,c). \) If \( 0<a<c \) are coprime with \( c>2, \) let

$$\begin{aligned} \mathcal {U}\left( \frac{a}{c};q \right)&=\mathcal {U}\left( \frac{a}{c};z \right) :=\frac{\eta \left( \frac{z}{2} \right) }{\eta ^2(z)}\sin \left( \frac{\pi a}{c} \right) \sum _{n\in \mathbb {Z}}\frac{(1+q^n)q^{n^2+\frac{n}{2}}}{1-2\cos \left( \frac{2\pi a}{c} \right) q^n+q^{2n} }, \\ \mathcal {U}(a,b,c;q)&=\mathcal {U}(a,b,c;z):=\frac{\eta \left( \frac{z}{2} \right) }{\eta ^2(z)} e^{\frac{\pi ia}{c}\left( \frac{4b}{c}-1-2s \right) }q^{\frac{sb}{c}+\frac{b}{2c}-\frac{b^2}{c^2}}\sum _{m\in \mathbb {Z}}\frac{q^{\frac{m}{2}(2m+1)+ms}}{1-e^{-\frac{2\pi ia}{c}}q^{m+\frac{b}{c}}},\\ \mathcal {V}\left( a,b,c; q\right)&=\mathcal {V}(a,b,c;z):=\frac{\eta \left( \frac{z}{2} \right) }{\eta ^2(z)}e^{\frac{\pi i a}{c}\left( \frac{4b}{c}-1-2s \right) }q^{\frac{sb}{c}+\frac{b}{2c}-\frac{b^2}{c^2}}\\&\quad \times \, \sum _{m\in \mathbb {Z}}\frac{q^{\frac{m(2m+1)}{2}+ms}\big ( 1+e^{-\frac{2\pi i a}{c}}q^{m+\frac{b}{c}}\big ) }{1-e^{-\frac{2\pi i a}{c}}q^{m+\frac{b}{c}}},\\ \mathcal {O}\left( a,b,c; q\right)&=\mathcal {O}(a,b,c;z)\\&:=\frac{\eta (2z)}{\eta ^2(z)}e^{\frac{\pi i a}{c}\left( \frac{4b}{c}-1-t \right) }q^{\frac{tb}{2c}+\frac{b}{2c}-\frac{b^2}{c^2}}\sum _{m\in \mathbb {Z}}(-1)^m\frac{q^{\frac{m}{2}(2m+1)+\frac{mt}{2}} }{1-e^{-\frac{2\pi i a}{c}}q^{m+\frac{b}{c}}}, \\ \mathcal {V}\left( \frac{a}{c}; q\right)&\,\,=\mathcal {V}\left( \frac{a}{c};z \right) := \frac{\eta (2z)}{\eta ^2(z)}q^{\frac{1}{4}}\sum _{m\in \mathbb {Z}}\frac{q^{m^2+m}\big ( 1+e^{-\frac{2\pi ia}{c}}q^{m+\frac{1}{2}}\big ) }{1-e^{-\frac{2\pi ia}{c}}q^{m+\frac{1}{2}}}, \end{aligned}$$

and consider the Mordell-type integral

$$\begin{aligned} I_{a,c,k,\nu }:=\int _{\mathbb {R}}e^{-\frac{2\pi zx^2}{k}}H_{a,c}\left( \frac{2\pi i\nu }{k}-\frac{2\pi zx}{k}-\frac{\widetilde{k}\pi i}{2k} \right) dx, \end{aligned}$$

where \(\nu \in \mathbb {Z},\) \( k\in \mathbb {N} \) and \( \widetilde{k} \) are as defined in Sect. 2.1, and

$$\begin{aligned} H_{a,c}(x):=\frac{e^x}{1-2\cos \left( \frac{2\pi a}{c} \right) e^x+e^{2x} }. \end{aligned}$$

Using Poisson summation, Bringmann and Lovejoy [9] proved the following transformation laws.

Theorem 6

[9] Assume the previously introduced notation and let \( q=e^{\frac{2\pi i}{k}(h+iz)} \) and \( q_1=e^{\frac{2\pi i}{k}\left( h'+\frac{i}{z}\right) }, \) with \( z\in \mathbb {C}\) and \( {{\,\mathrm{Re}\,}}(z)>0. \)

(1):

If \( c\mid k \) and \(2\mid k, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} (-1)^{k_1+1}i\cdot e^{-\frac{2\pi a^2h'k_1}{c}}\cdot \tan \left( \frac{\pi a}{c} \right) \\&\quad \cdot \cot \left( \frac{\pi ah'}{c}\right) \frac{\omega ^2_{h,k}}{\omega _{h,k/2}}z^{-\frac{1}{2}}\cdot \mathcal {O}\left( \frac{ah'}{c};q_1 \right) \\&+ \frac{4\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{h,k/2}\cdot k}z^{-\frac{1}{2}}\sum _{\nu =0}^{k-1}(-1)^{\nu }e^{-\frac{2\pi ih'\nu ^2}{k}}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$
(2):

If \( c\mid k \) and \( 2\not \mid k, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} -\sqrt{2}i\cdot e^{\frac{\pi ih'}{8k}-\frac{2\pi i a^2h'k_1}{c}}\cdot \tan \left( \frac{\pi a}{c} \right) \frac{\omega ^2_{h,k}}{\omega _{2h,k}}z^{-\frac{1}{2}}\cdot \mathcal {U}\left( \frac{ah'}{c};q_1 \right) \\&+ \frac{4\sqrt{2}\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{2h,k}\cdot k}z^{-\frac{1}{2}}\sum _{\nu =0}^{k-1}e^{-\frac{\pi ih'}{k}(2\nu ^2-\nu )}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$
(3):

If \( c\not \mid k, \) \( 2\mid k \) and \( c_1\ne 2, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} 2 e^{-\frac{2\pi ia^2h'k_1}{c_1c}}\cdot \tan \left( \frac{\pi a}{c} \right) \frac{\omega ^2_{h,k}}{\omega _{h,k/2}}z^{-\frac{1}{2}} \\&\times (-1)^{c_1(\ell +k_1)}\cdot \mathcal {O}\left( ah',\frac{\ell c}{c_1},c;q_1 \right) \\&+ \frac{4\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{h,k/2}\cdot k} z^{\frac{1}{2}}\sum _{\nu =0}^{k-1}(-1)^{\nu }e^{-\frac{2\pi ih'\nu ^2}{k}}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$
(4):

If \( c\not \mid k, \) \( 2\mid k \) and \( c_1=2, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} e^{-\frac{\pi ia^2h'k_1}{c}}\cdot \tan \left( \frac{\pi a}{c} \right) \frac{\omega ^2_{h,k}}{\omega _{h,k/2}\cdot k}z^{-\frac{1}{2}}\cdot \mathcal {V}\left( \frac{ah'}{c};q_1 \right) \\&+ \frac{4\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{h,k/2}\cdot k} z^{\frac{1}{2}}\sum _{\nu =0}^{k-1}(-1)^{\nu }e^{-\frac{2\pi ih'\nu ^2}{k}}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$
(5):

If \( c\not \mid k, \) \( 2\not \mid k \) and \( c_1\ne 4, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} \sqrt{2} e^{\frac{\pi ih'}{8k}-\frac{2\pi i a^2h'k_1}{c_1c}}\cdot \tan \left( \frac{\pi a}{c} \right) \frac{\omega ^2_{h,k}}{\omega _{2h,k}}z^{-\frac{1}{2}}\cdot \mathcal {U}\left( ah',\frac{\ell c}{c_1},c;q_1 \right) \\&+ \frac{4\sqrt{2}\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{2h,k}\cdot k} z^{\frac{1}{2}}\sum _{\nu =0}^{k-1}e^{-\frac{\pi ih'}{k}(2\nu ^2-\nu )}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$
(6):

If \( c\not \mid k, \) \( 2\not \mid k \) and \( c_1= 4, \) then

$$\begin{aligned} \mathcal {O}\left( \frac{a}{c};q \right)= & {} e^{\frac{\pi ih'}{8k}-\frac{2\pi i a^2h'k_1}{c_1c}}\cdot \tan \left( \frac{\pi a}{c} \right) \frac{\omega ^2_{h,k}}{\sqrt{2}\cdot \omega _{2h,k}}z^{-\frac{1}{2}}\cdot \mathcal {V}\left( ah',\frac{\ell c}{c_1},c;q_1 \right) \\&+ \frac{4\sqrt{2}\sin ^2\left( \frac{\pi a}{c}\right) \cdot \omega ^2_{h,k}}{\omega _{2h,k}\cdot k} z^{\frac{1}{2}}\sum _{\nu =0}^{k-1}e^{-\frac{\pi ih'}{k}(2\nu ^2-\nu )}\cdot I_{a,c,k,\nu }(z) . \end{aligned}$$

2.4 Circle method

By Cauchy’s Theorem, for any \( n\ge 1 \) we have

$$\begin{aligned} A\left( \frac{a}{c};n \right) =\frac{1}{2\pi i}\int _{\mathcal C}\frac{\mathcal {O}\left( \frac{a}{c};q \right) }{q^{n+1}}dq, \end{aligned}$$

where \(\mathcal {C} \) is the circle of radius \( e^{-\frac{2\pi }{n}} \) parametrized by \( q=e^{-\frac{2\pi }{n}+2\pi it}, \) for \( t\in [0,1], \) from which we further get

$$\begin{aligned} A\left( \frac{a}{c};n \right) =\int _0^1\mathcal {O}\left( \frac{a}{c};e^{-\frac{2\pi }{n}+2\pi it} \right) \cdot e^{2\pi -2\pi int}dt. \end{aligned}$$

If \( \frac{h_1}{k_1}<\frac{h}{k}<\frac{h_2}{k_2} \) are adjacent Farey fractions in the Farey sequence of order \( N=\lfloor \sqrt{n}\rfloor , \) we set

$$\begin{aligned} \vartheta _{h,k}':=\frac{1}{k(k_1+k)}\quad \text {and}\quad \vartheta _{h,k}'':=\frac{1}{k(k_2+k)}. \end{aligned}$$

Splitting the path of integration along the Farey arcs \( -\vartheta _{h,k}'\le \varPhi \le \vartheta _{h,k}'', \) where \( \varPhi =t-\frac{h}{k} \) and \( 0\le h< k\le N \) with \((h,k)=1, \) we have

$$\begin{aligned} A\left( \frac{a}{c};n \right) =\sum _{h,k}e^{-\frac{2\pi inh}{k}}\int _{-\vartheta _{h,k}'}^{\vartheta _{h,k}''} \mathcal O\left( \frac{a}{c}; e^{\frac{2\pi i}{k}(h+iz)}\right) \cdot e^{\frac{2\pi nz}{k}} d\varPhi , \end{aligned}$$
(3)

where \( z=\frac{k}{n}-k\varPhi i. \) Applying Theorem 6 to (3), we can now express

$$\begin{aligned}&A\left( \frac{a}{c};n \right) = i\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2|k,~c|k \end{array}}\frac{\omega ^2_{h,k}}{\omega _{h,k/2}}(-1)^{k_1+1}\cot \left( \frac{\pi ah'}{c} \right) e^{-\frac{2\pi ia^2h'k_1}{c}-\frac{2\pi inh}{k}}\\&\qquad \int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {O}\left( \frac{ah'}{c}; q_1\right) d\varPhi \\&\quad -\sqrt{2}i\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2\not \mid k,~c|k \end{array}}\frac{\omega ^2_{h,k}}{\omega _{2h,k}}e^{\frac{\pi ih'}{8k}-\frac{2\pi ia^2h'k_1}{c}-\frac{2\pi inh}{k}}\int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {U}\left( \frac{ah'}{c}; q_1\right) d\varPhi \\&\quad +2\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2|k,~c\not \mid k,~c_1\ne 2 \end{array}}\frac{\omega ^2_{h,k}}{\omega _{h,k/2}}(-1)^{c_1(\ell +k_1)}e^{-\frac{2\pi ia^2h'k_1}{c_1c}-\frac{2\pi inh}{k}}\\&\qquad \quad \times \int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {O}\left( ah',\frac{\ell c}{c_1},c; q_1\right) d\varPhi \\&\quad +\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2| k,~c\not \mid k,~c_1= 2 \end{array}}\frac{\omega ^2_{h,k}}{\omega _{h,k/2}}e^{-\frac{\pi ia^2h'k_1}{c}-\frac{2\pi inh}{k}}\int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {V}\left( \frac{ah'}{c}; q_1\right) d\varPhi \\&\quad +\sqrt{2}\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2\not \mid k,~c\not \mid k,~c_1\ne 4 \end{array}}\frac{\omega ^2_{h,k}}{\omega _{2h,k}}e^{\frac{\pi ih'}{8k}-\frac{2\pi ia^2h'k_1}{c_1c}-\frac{2\pi inh}{k}}\\&\qquad \quad \times \int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {U}\left( ah',\frac{\ell c}{c_1},c; q_1\right) d\varPhi \\&\quad +\frac{1}{\sqrt{2}}\tan \left( \frac{\pi a}{c} \right) \sum _{\begin{array}{c} h,k\\ 2\not \mid k,~c\not \mid k,~c_1= 4 \end{array}}\frac{\omega ^2_{h,k}}{\omega _{h,k/2}}e^{\frac{\pi ih'}{8k}-\frac{2\pi ia^2h'k_1}{c_1c}-\frac{2\pi inh}{k}}\\&\qquad \quad \times \int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{-\frac{1}{2}} e^{\frac{2\pi nz}{k}} \mathcal {V}\left( ah',\frac{\ell c}{c_1},c; q_1\right) d\varPhi \\&\quad +4\sin ^2\left( \frac{\pi a}{c}\right) \sum _{\begin{array}{c} h,k\\ 2|k \end{array}}\frac{\omega ^2_{h,k}}{\omega _{h,k/2}\cdot k} e^{-\frac{2\pi inh}{k}} \\&\qquad \quad \times \sum _{\nu =0}^{k-1}(-1)^{\nu }e^{-\frac{2\pi ih'\nu ^2}{k}}\int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{\frac{1}{2}} e^{\frac{2\pi nz}{k}} I_{a,c,k,\nu }(z)d\varPhi \\&\quad +4\sqrt{2}\sin ^2\left( \frac{\pi a}{c}\right) \sum _{\begin{array}{c} h,k\\ 2\not \mid k \end{array}}\frac{\omega ^2_{h,k}}{\omega _{2h,k}\cdot k} e^{-\frac{2\pi inh}{k}} \\&\qquad \quad \times \sum _{\nu =0}^{k-1}e^{-\frac{\pi ih'}{k}(2\nu ^2-\nu )}\int _{-\vartheta '_{h,k}}^{\vartheta ''_{h,k}} z^{\frac{1}{2}} e^{\frac{2\pi nz}{k}} I_{a,c,k,\nu }(z)d\varPhi \\&\quad =:\sum _1+\sum _2+\sum _3+\sum _4+\sum _5+\sum _6+\sum _7+\sum _8. \end{aligned}$$

2.5 Asymptotics for the coefficients \( A\left( \frac{a}{c};n \right) \)

As explained in [10], a careful investigation shows that only the sums \( \sum _2 \) and \( \sum _5 \) contribute asymptotically, while all the others are seen to be of order \( O(n^{\varepsilon }), \) for any given \( \varepsilon >0. \) Consequently, we have the following.

Theorem 7

[10] If \( 0<a<c \) are coprime positive integers and \( \varepsilon >0 \) is arbitrary, then

$$\begin{aligned} A\left( \frac{a}{c};n\right)&=i\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c|k,~2\not \mid k \end{array}}\frac{B_{a,c,k}(-n,0)}{\sqrt{k}}\cdot \sinh \left( \frac{\pi \sqrt{n}}{k}\right) \\&\quad +2\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c\not \mid k,~2\not \mid k,~c_1\ne 4\\ r\ge 0,~ \delta _{c,k,r}>0 \end{array}}\frac{D_{a,c,k}(-n,m_{a,c,k,r})}{\sqrt{k}}\cdot \sinh \left( \frac{4\pi \sqrt{\delta _{c,k,r}n}}{k} \right) \\&\quad +O_c(n^{\varepsilon }). \end{aligned}$$

Remark 7

One can easily note that \( B_{a,c,k}\in i\mathbb {R}\) and \(D_{a,c,k}\in \mathbb {R}.\) The latter follows from the fact that \( \overline{D}_{a,c,k} \) is defined by the same summatory formula as \( D_{a,c,k}, \) but taken over \( -h \) instead, while the former is a consequence of the same argument combined with the fact that the factor \( \sin \big (\frac{\pi a h'}{c} \big )^{-1} \) enters now every summand.

Remark 8

As pointed out in [10, p. 5], in evaluating the sums \( B_{a,c,k} \) and \( D_{a,c,k} \) from Theorem 7, the integer \( h' \) is always taken to be even, cf. Bringmann and Lovejoy [9, pp. 14–15].

3 Strategy of the proof

In this section we will sketch the main ideas of the proof of Theorem 1. To this end, we believe it is in the benefit of the reader interested to consult [8] to keep the notation used there.

Recall that, as explained in Sect. 1.3, due to the fact that \( \overline{N}(a,c,n)=\overline{N}(c-a,c,n), \) we do not restrict the generality by assuming that \( 0\le a<b\le \left\lfloor \frac{c}{2}\right\rfloor . \)

3.1 Orthogonality relation

From the orthogonality of the roots of unity, it follows that

$$\begin{aligned} \sum _{n=0}^{\infty }\overline{N}(a,c,n)q^n=\frac{1}{c}\sum _{n=0}^{\infty }\overline{p}(n)q^n+\frac{1}{c}\sum _{j=1}^{c-1}\zeta _c^{-aj}\cdot \mathcal {O}(\zeta _c^j;q). \end{aligned}$$
(4)

Combining identity (4) with the fact that \( \overline{N}(a,c,n)=\overline{N}(c-a,c,n) \), we obtain

$$\begin{aligned} \sum _{n=0}^{\infty }(\overline{N}(a,c,n)-\overline{N}(b,c,n))q^n= & {} \frac{2}{c}\sum _{j=1}^{\frac{c-1}{2}}\rho _j(a,b,c) \mathcal {O}(\zeta _c^j;q)\nonumber \\= & {} \frac{2}{c}\sum _{j=1}^{\frac{c-1}{2}}\rho _j(a,b,c) \sum _{n=0}^{\infty }A\left( \frac{j}{c};q \right) q^n \end{aligned}$$
(5)

if \( 2\not \mid c, \) and

$$\begin{aligned}&\sum _{n=0}^{\infty }(\overline{N}(a,c,n)-\overline{N}(b,c,n))q^n\nonumber \\&\quad =\frac{2}{c}\sum _{j=1}^{\frac{c-2}{2}}\rho _j(a,b,c) \mathcal {O}(\zeta _c^j;q)+((-1)^a-(-1)^b)\mathcal {O}(-1;q)\nonumber \\&\quad =\frac{2}{c}\sum _{j=1}^{\frac{c-2}{2}}\rho _j(a,b,c)\sum _{n=0}^{\infty }A\left( \frac{j}{c};q \right) q^n+((-1)^a-(-1)^b)\sum _{n=0}^{\infty }\mathcal {O}\left( \frac{1}{2};q \right) q^n \end{aligned}$$
(6)

if \( 2\mid c, \) where

$$\begin{aligned} \rho _j(a,b,c):=\cos \left( \frac{2\pi a j}{c}\right) -\cos \left( \frac{2\pi bj}{c} \right) . \end{aligned}$$

Before moving forward, a remark is in order, namely that in the summations carried over j in the identities (4)–(6), we need to replace j and c by \( j'=\frac{j}{(c,j)} \) and \( c'=\frac{c}{(c,j)}. \) As such, whenever \( (c,j)>1, \) the statement of Theorem 7 applies, instead, to the coefficients \(A\big (\frac{j'}{c'};q\big ).\)

3.2 Asymptotical contributions

Let us only focus for now on the case when c is odd, as the other case will be treated in essentially the same manner. For simplicity, we can further assume that c is prime. As explained in [8], and as it will also become clear in the course of our proof, this assumption does not restrict the generality and it will only lead to slightly different bounds when estimating the error terms (which we do explicitly in the next section), without affecting the main result whatsoever. Coming back to our problem, let us write

$$\begin{aligned} \overline{N}(a,c,n)-\overline{N}(b,c,n)=\sum _{j=1}^{\frac{c-1}{2}}(S_j(a,b,c)+T_j(a,b,c))+O_c(n^{\varepsilon }), \end{aligned}$$

where

$$\begin{aligned} S_j(a,b,c):=2\rho _j(a,b,c)i\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c|k,~2\not \mid k \end{array}}\frac{B_{j,c,k}(-n,0)}{c\sqrt{k}}\cdot \sinh \left( \frac{\pi \sqrt{n}}{k}\right) \end{aligned}$$

and

$$\begin{aligned} T_j(a,b,c)&:=4\rho _j(a,b,c)\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c\not \mid k,~2\not \mid k,~c_1\ne 4\\ r\ge 0,~ \delta _{c,k,r}>0 \end{array}}\frac{D_{j,c,k}(-n,m_{j,c,k,r})}{c\sqrt{k}} \\&\qquad \cdot \sinh \left( \frac{4\pi \sqrt{\delta _{c,k,r}n}}{k} \right) . \end{aligned}$$

Now, if we can identify the term that gives the main contribution to the sums on \( S_j \) and \( T_j, \) and if this term has a positive coefficient, then we are done. Indeed, we will shortly see that for \( c\ge 7 \) the main contribution can only come from the term in \( T_1 \) corresponding to \( k=1\) and \(r=0, \) in which case \( D_{1,c,1}=1 \) and \(\rho _1(a,b,c)>0 \) for any \( 0\le a<b\le \frac{c-1}{2}.\) Proving that a value \( n_{a,b,c} \) exists, beyond which (2) always holds, is then only a matter of carefully bounding some error terms. Our proof will also explain why, for the small moduli \(c\le 6\), the sign of the inequalities might depend on the residue class of n modulo c.

4 Proofs of the main results

In the way described in the previous section, we start by giving the proof of Theorem 1. The proof of Theorem 2 will then be nothing more than a computation, while Theorems 35 will follow fairly easily.

Proof (of Theorem 1)

We distinguish two cases, and we first treat the case when \( c\ge 7 \) is odd.

Case 1: \( 2\not \mid c. \) Without restricting generality, assume that c is prime. While this assumption does not affect the result, it also simplifies our task, in that we do not have to worry about possible common divisors of c and j,  and so we do not need to pass down to \( j' \) or \( c' \) (if anything, this would just make the notation more cumbersome and lead to slightly different estimates for the error terms, but the conclusion is essentially the same). As already seen, we have

$$\begin{aligned} \overline{N}(a,c,n)-\overline{N}(b,c,n)=\sum _{j=1}^{\frac{c-1}{2}}(S_j(a,b,c)+T_j(a,b,c))+O_c(n^{\varepsilon }), \end{aligned}$$

where

$$\begin{aligned} S_j(a,b,c)=2\rho _j(a,b,c)i\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c|k,~2\not \mid k \end{array}}\frac{B_{j,c,k}(-n,0)}{c\sqrt{k}}\cdot \sinh \left( \frac{\pi \sqrt{n}}{k}\right) \end{aligned}$$
(7)

and

$$\begin{aligned} T_j(a,b,c)=4\rho _j(a,b,c)\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c\not \mid k,~2\not \mid k,~c_1\ne 4\\ r\ge 0,~ \delta _{c,k,r}>0 \end{array}}\frac{D_{j,c,k}(-n,m_{j,c,k,r})}{c\sqrt{k}}\cdot \sinh \left( \frac{4\pi \sqrt{\delta _{c,k,r}n}}{k} \right) . \end{aligned}$$
(8)

4.1 Determining the dominant terms

Knowing that the error term from Theorem 7 is of order \( O(n^\varepsilon ), \) we only need to identify what is the main contribution coming from the sums \( S_j \) and \( T_j. \) For this, we first compare the arguments of the hyperbolic sines appearing in (7) and (8). In \( S_j, \) the main term occurs for \( k=c, \) giving \( \sinh \left( \frac{\pi \sqrt{n}}{c}\right) \) as the main hyperbolic sine argument, whereas in \( T_j \) it is given by \( k=1, \) in which case we have \( k_1=1 \) and \( c_1=c, \) and thus the condition yields \( \ell =j. \) Due to symmetry reasons, we can assume that \( \frac{\ell }{c}\le \frac{1}{4}, \) and hence we compute \( \delta _{c,k,r}=\delta _{c,1,r}=\big ( \frac{j}{c}-\frac{1}{4}\big )^2-r\frac{\ell }{c_1}, \) with \( r\ge 0, \) which is maximized by \( \delta _{c,1,0}=\big ( \frac{j}{c}-\frac{1}{4}\big )^2\) for \( r=0. \) Running over j,  the maximum value is obviously attained for \( j=1, \) which gives \( \sinh \left( \pi \sqrt{n}\left( 1-\frac{4}{c} \right) \right) \) as the main hyperbolic sine term. We only need to make sure that \( D_{1,c,1}(-n,0)\ne 0, \) but this is clear since, for \( k=1, \) \( r=0 \) and any j,  we easily see that \( D_{j,c,k}(-n,m_{j,c,k,r})=D_{j,c,1}(-n,0)=1. \) Now, since

$$\begin{aligned} 1-\frac{4}{c}=\frac{c-4}{c}>\frac{1}{c} \end{aligned}$$

for any \( c\ge 7 \) (in fact, for any \( c\ge 6 \)), we conclude that the term which gives the main contribution equals

$$\begin{aligned} T_1(a,b,c)=\frac{4}{c\sqrt{n}}\tan \left( \frac{\pi }{c} \right) \rho _1(a,b,c)\sinh \left( \pi \sqrt{n}\left( 1-\frac{4}{c} \right) \right) , \end{aligned}$$
(9)

and this is positive for all \( 0\le a<b\le \frac{c-1}{2}. \)

In order to infer that the inequality (2) holds for n sufficiently large, we only need to prove that the contribution of the other terms entering the expressions of \( S_j \) and \( T_j \) is asymptotically smaller than \( T_1(a,b,c), \) and this is what we will do next.

4.2 Bounding the contributions of \(S_j\) and \(T_j\)

We first consider \(S_j,\) for which we have the estimate

We bound the innermost sum using the estimate

where the first inequality follows from the fact that \( c\le k \) (because by assumption \( c\mid k \)), the second from the inequality \( |\sin x|\ge x-\frac{x^3}{6}, \) and the third from the well-known bound for the harmonic series. This gives further

$$\begin{aligned} |S_j(a,b,c)|&<\frac{4\sqrt{2}|\rho _j(a,b,c)|}{c\sqrt{n}}\frac{\big |\tan \big (\frac{\pi j}{c} \big ) \big | \left( 1+\log \left( \frac{c-1}{2} \right) \right) }{\pi \left( 1-\frac{\pi ^2}{24}\right) } \\&\times \sinh \left( \frac{\pi \sqrt{n}}{c}\right) \sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c|k,~2\not \mid k \end{array}}\sqrt{k}\\&<\frac{16\cot \left( \frac{\pi }{2c} \right) \left( 1+\log \left( \frac{c-1}{2} \right) \right) }{c^2\pi \left( 1-\frac{\pi ^2}{24}\right) }n^{\frac{3}{4}} \sinh \left( \frac{\pi \sqrt{n}}{c}\right) , \end{aligned}$$

where we used the Cauchy–Schwarz inequality to bound the sum over k.

We next explicitly estimate the error coming from \( T_j. \) We have to look at the terms with \( k\ge 2 \) and at those that have \( k=1, \) but are different than the main term. For this, we trivially bound

$$\begin{aligned} |D_{j,c,k}| \le \frac{k}{\sqrt{2}}\tan \left( \frac{\pi j}{c} \right) . \end{aligned}$$

For \( k\ge 2, \) the argument of the hyperbolic sine is at most half that of the main term, namely

$$\begin{aligned} \sinh \left( \pi \sqrt{n}\left( \frac{1}{2}-\frac{2}{c} \right) \right) . \end{aligned}$$

Next, note that the number of r’s satisfying \( \delta _{c,k,r}>0 \) is decreasing as a function of \( \ell , \) and thus attains its maximum at \( \ell =1, \) in which case it equals

$$\begin{aligned} \left\lfloor \frac{c_1}{16}-\frac{1}{2}+\frac{1}{c_1}\right\rfloor <\frac{c+8}{16}, \end{aligned}$$

and therefore the contribution coming from \( k\ge 2 \) can be estimated against

$$\begin{aligned} \frac{c+8}{2c\sqrt{n}}n^{\frac{3}{4}}\cot \left( \frac{\pi }{2c} \right) \sinh \left( \pi \sqrt{n}\left( \frac{1}{2}-\frac{2}{c} \right) \right) <\frac{c+8}{4c\sqrt{n}}n^{\frac{3}{4}}\cot \left( \frac{\pi }{2c} \right) e^{\pi \sqrt{n}\left( \frac{1}{2}-\frac{2}{c} \right) }. \end{aligned}$$
(10)

Finally, the terms with \( k=1 \) have \( j\ge 2. \) But \( k=1 \) implies \( k_1=1, \) and so \( \ell =j\ge 2, \) which then means that the contribution coming from these terms can be estimated against

$$\begin{aligned} \frac{c+8}{2c\sqrt{n}}\cot \left( \frac{\pi }{2c} \right) \sinh \left( \pi \sqrt{n}\left( 1-\frac{8}{c} \right) \right) <\frac{c+8}{4c\sqrt{n}}\cot \left( \frac{\pi }{2c} \right) e^{\pi \sqrt{n}\left( 1-\frac{8}{c} \right) }. \end{aligned}$$
(11)

On comparing (10) and (11) with the main term \( T_1(a,b,c) \) from (9), we conclude this part of the proof. What is left to do is to make the error term explicit and bound it in an optimal way. We do so after discussing the case when c is even.

Case 2: \( 2\mid c. \) In this case, we have

$$\begin{aligned}&\sum _{n=0}^{\infty }(\overline{N}(a,c,n)-\overline{N}(b,c,n))q^n \\&\qquad =\frac{2}{c}\sum _{j=1}^{\frac{c-2}{2}}\rho _j(a,b,c) \mathcal {O}(\zeta _c^j;q)+((-1)^a-(-1)^b)\mathcal {O}(-1;q). \end{aligned}$$

As explained in the proof of Corollary 1 from [10, p. 22], the coefficients of \( \mathcal {O}(-1;q), \) which is the holomorphic part of a harmonic Maass form of weight 3/2,  are of order \( O(n^\varepsilon ). \) Therefore, we can ignore them from our analysis, since the main contribution will come from the sum over j.

We continue by noting that, since c is even, the terms \( B_{j,c,k} \) do not contribute to the sum, hence

$$\begin{aligned} \sum _{n=0}^{\infty }(\overline{N}(a,c,n)-\overline{N}(b,c,n))q^n=\frac{2}{c}\sum _{j=1}^{\frac{c-2}{2}}T_j(a,b,c)+O(n^\varepsilon ), \end{aligned}$$

where

$$\begin{aligned} T_j(a,b,c)&=4\rho _j(a,b,c)\sqrt{\frac{2}{n}}\sum _{\begin{array}{c} 1\le k\le \sqrt{n}\\ c\not \mid k,~2\not \mid k,~c_1\ne 4\\ r\ge 0,~ \delta _{c,k,r}>0 \end{array}}\frac{D_{j,c,k}(-n,m_{j,c,k,r})}{c\sqrt{k}} \\&\quad \times \sinh \left( \frac{4\pi \sqrt{\delta _{c,k,r}n}}{k} \right) . \end{aligned}$$

The term corresponding to \( j=1 \) and \( k=1 \) gives \(\sinh \left( \pi \sqrt{n}\left( 1-\frac{4}{c} \right) \right) \) as maximum argument. For any other j (which might now have common divisors with c), set \( j'=\frac{j}{(c,j)} \) and \( c'=\frac{c}{(c,j)}. \) From the congruence we see that any value \( c_1'\le 4 \) will give \( \delta _{c',k,r}=0, \) and hence there can be no hyperbolic sine argument contributing. For \( c_1'>4, \) it is then easy to see that \( \delta _{c',k,r} \) is maximized by \( k=1, \) which in turn forces \( k_1=1 \) and \( c_1'=c'. \) The hyperbolic sine term will then be given by \( \sinh \left( \pi \sqrt{n}\left( 1-\frac{4j'}{c'} \right) \right) =\sinh \left( \pi \sqrt{n}\left( 1-\frac{4j}{c} \right) \right) , \) and this is smaller than the leading term for any \( j\ge 2. \)

We can now conclude the proof in this case by arguing in the following way. Pick any \( j\ge 2. \) If \( c' \) is even, then we are done, as the maximum possible contribution would be

$$\begin{aligned} \sinh \left( \pi \sqrt{n} \left( 1-\frac{4j'}{c_1'} \right) \right)= & {} \sinh \left( \pi \sqrt{n} \left( 1-\frac{4j'}{c'} \right) \right) =\sinh \left( \pi \sqrt{n} \left( 1-\frac{4j}{c} \right) \right) \\\le & {} \sinh \left( \pi \sqrt{n} \left( 1-\frac{8}{c} \right) \right) , \end{aligned}$$

which is smaller than the main term. The only issue might appear when \( 2\not \mid c', \) as there may then be another possible main term coming from the \( B_{j,c,k} \) sum, namely the one containing \( \sinh \left( \frac{\pi \sqrt{n}}{c'}\right) . \) In order to establish which one is bigger between these two, we need to compare \( \frac{1}{c'} \) with \( 1-\frac{4}{c}. \) Since we have

$$\begin{aligned} \frac{1}{c'}+\frac{4}{c}=\frac{j}{c}+\frac{4}{c}\le \frac{1}{2}+\frac{1}{2}=1 \end{aligned}$$

for \( c\ge 8, \) we are done.

What this shows is that for any \( c\ge 7, \) regardless of whether c is even or odd, the main contribution is always given by the term in (9). A separate study is required for \( c\le 6, \) as then the hyperbolic sine arguments from the sum \(B_{j,c,k}\) and \( D_{j,c,k} \) might coincide, and we need to explicitly evaluate their coefficients in order to establish which one dominates asymptotically. As the case \(c=6 \) has already been covered, one only needs to study the cases \( c\in \{2,3,4,5\}. \)

Next, we want to make explicit the error term appearing in Theorem 7. This would ensure then the existence of a number \( n_{a,b,c} \) such that the inequalities hold for every \( n>n_{a,b,c}. \)

4.3 Estimating the error terms

The analysis is a bit tedious, as the various sums give different types of errors and, as such, we need to bound them in different ways. In some cases, the arguments are similar to those from [8], while in some others we manage to simplify them and come up with neater estimates. Certainly, and this might be an interesting question for a minutious reader, our bounds can be improved.

As we do not want to repeat too much material here, we kindly invite the reader to follow the steps presented in the proof of [10, Theorem 1]. This is essential in understanding the following estimates.

4.3.1 Estimation of the error term arising from the Circle Method

For \( \sum _2, \) the error term, let us denote it by \( S_2, \) comes from the two sums taken over \( r\ge 1 \) in the expression for \( \widetilde{\mathcal {U}}\left( \frac{ah'}{c};q_1 \right) \) from [10, p. 15]. Recall that we write \( z=\frac{k}{n}-k\varPhi i. \) Using well-known facts from the theory of Farey arcs, such as

$$\begin{aligned} \mathrm{Re}(z)=\frac{k}{n},\quad \mathrm{Re}\left( \frac{1}{z}\right) >\frac{k}{2},\quad |z|^{-\frac{1}{2}}\le n^{\frac{1}{2}}\cdot k^{-\frac{1}{2}} \quad \text {and}\quad \vartheta _{h,k}'+\vartheta _{h,k}''\le \frac{2}{k(N+1)}, \end{aligned}$$

we can bound the error term coming from \(\sum _2\) by

$$\begin{aligned} S_2&< 4e^{2\pi }\sqrt{2}\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}}\cdot \sum _{r\ge 1} \overline{p}(r)\Big ( e^{-\frac{(16r-1)\pi }{16}}+e^{-\frac{(16r+7)\pi }{16}}\Big )\\&<4c_1e^{2\pi }\sqrt{2}\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}}, \end{aligned}$$

where

$$\begin{aligned} c_1:=\sum _{r\ge 1} \overline{p}(r)\Big ( e^{-\frac{(16r-1)\pi }{16}}+e^{-\frac{(16r+7)\pi }{16}}\Big ). \end{aligned}$$

In the same way we bound the error terms coming from the sums \( \sum _5 \) and \( \sum _6, \) which we denote \( S_5 \) and \( S_6, \) by

$$\begin{aligned} S_5&<c_2e^{2\pi }\sqrt{2}\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}},\\ S_6&<\frac{c_2e^{2\pi }}{\sqrt{2}}\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}}, \end{aligned}$$

where

$$\begin{aligned} c_2:=2\sum _{r\ge 1}\overline{p}(r)e^{-\frac{(c^2-8)\pi r}{16c^2}}. \end{aligned}$$

Now, for the sums \( \sum _1,\sum _3,\sum _4 \) we can argue similarly, and, denoting the error terms by \( S_1,S_3,S_4 \), respectively, we obtain

$$\begin{aligned} S_1&<4c_3e^{2\pi }\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}},\\ S_3&<2c_4e^{2\pi }\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}},\\ S_4&<c_5e^{2\pi }\cot \left( \frac{\pi }{2c} \right) \sum _{k}k^{-\frac{1}{2}}, \end{aligned}$$

where

$$\begin{aligned} c_3&:=\sum _{r\ge 1}\overline{p}(r)e^{-\pi r},\\ c_4&:=\sum _{r\ge 1}\overline{p}(r)e^{-\frac{\pi r}{2c^2}},\\ c_5&:=\sum _{r\ge 1}\overline{p}(r)e^{-\frac{(2r+1)\pi }{8}}. \end{aligned}$$

Remark 9

The fact that the sums entering the expressions of \( c_1,\ldots ,c_5 \) are convergent follows from the well-known asymptotic estimate \(\overline{p}(n)\sim \frac{1}{8n}e^{\pi \sqrt{n}},\) which implies \( \overline{p}(n)\ll e^{\pi \sqrt{n}}; \) see, for instance, [16]. Therefore \( c_1,\ldots ,c_5 \) are indeed well-defined positive constants.

4.3.2 Estimates of the error terms \( \sum _7 \) and \( \sum _8 \) given by Mordell integrals

Note that \( H_{j,c}(x)=H_{j,c}^+(x)+H_{j,c}^-(x), \) where

$$\begin{aligned} H_{j,c}^{\pm }=\pm \frac{i}{8\cosh \left( \frac{x}{2} \right) \sin \left( \frac{\pi a}{c} \right) \sinh \left( \frac{x}{2}\pm \frac{\pi a }{c} \right) }. \end{aligned}$$

We can therefore split the sum just like in [8, pp. 937–938], and we denote the contributions of these functions to \( I_{j,c,k,\nu } \) by \( I_{j,c,k,\nu }^\pm . \) From the proof of [10, Lemma 1] we obtain

$$\begin{aligned} z^{\frac{1}{2}}I_{j,c,k,\nu }^\pm&\le \frac{\sqrt{k}}{8\sqrt{2}\big | \sin \big (\frac{\pi \nu }{k} -\frac{\pi }{4k}\pm \frac{\pi j}{c}\big )\big | \big | \sin \big (\frac{\pi j}{c}\big )\big | \big ( {{\,\mathrm{Re}\,}}\big (\frac{1}{z} \big ) |z|\big ) ^{\frac{1}{2}}}\\ {}&\le \frac{\sqrt{n}}{8\sqrt{k}\big | \sin \big (\frac{\pi \nu }{k} -\frac{\pi }{4k}+\frac{\pi a}{c}\big )\big | \big | \sin \big (\frac{\pi j}{c}\big )\big | }. \end{aligned}$$

Denoting

$$\begin{aligned} \mathcal {S}_{a,c,k}^\pm :=\sum _{\nu =1}^{k}\frac{1}{\left| \sin \left( \frac{\pi \nu }{k}-\frac{\pi }{4k}\pm \frac{\pi a}{c} \right) \right| }, \end{aligned}$$

we have

$$\begin{aligned} \mathcal {S}_{a,c,k}^-&\le \sum _{\nu =1}^{k}\frac{1}{\left| \sin \left( \frac{\pi \nu }{k}-\frac{\pi }{2k} \right) \right| }=\sum _{\nu =1}^{\left\lfloor \frac{k}{2}\right\rfloor }\frac{1}{ \sin \left( \frac{\pi \nu }{k}-\frac{\pi }{2k} \right) }+\sum _{\nu =0}^{\left\lfloor \frac{k+1}{2}\right\rfloor -1}\frac{1}{ \sin \left( \frac{\pi \nu }{k}+\frac{\pi }{2k} \right) }\\&<\frac{k}{\pi } \sum _{\nu =1}^{\left\lfloor \frac{k}{2}\right\rfloor }\frac{1}{\left( \nu -\frac{1}{2}\right) \left( 1-\frac{1}{6}\left( \frac{\pi }{k}\left( \left\lfloor \frac{k}{2} \right\rfloor -\frac{1}{2}\right) \right) ^2 \right) }\\&\quad +\frac{k}{\pi }\sum _{\nu =0}^{\left\lfloor \frac{k+1}{2}\right\rfloor -1}\frac{1}{\left( \nu +\frac{1}{2}\right) \left( 1-\frac{1}{6}\left( \frac{\pi }{k}\left( \left\lfloor \frac{k+1}{2} \right\rfloor -\frac{1}{2}\right) \right) ^2 \right) }<\frac{2k\log \left( \frac{k}{2} \right) }{\pi \left( 1-\frac{\pi ^2}{24} \right) }, \end{aligned}$$

and a similar estimate for \( \mathcal {S}_{a,c,k}^+.\) We thus obtain

$$\begin{aligned} \sum _7 \le \frac{\log \left( \frac{k}{2} \right) }{2\pi \left( 1-\frac{\pi ^2}{24} \right) \sin \left( \frac{\pi }{c} \right) } \sum _k \sqrt{k}<\frac{n^{\frac{3}{4}}\log \left( \frac{n}{4}\right) }{2\pi \left( 1-\frac{\pi ^2}{24} \right) \sin \left( \frac{\pi }{c} \right) }, \end{aligned}$$

while a similar bound holds for \( \sum _8. \)

4.3.3 Symmetrizing the paths of integration

Such errors are only given by the sums that contribute to the main term, which are \( \sum _2,\sum _5\) and \(\sum _6. \) As it can be seen in [10, p. 19], making the path of integration symmetric leads to a Hankel-type integral that will give the main term, and an error term arising from integrating over the remaining parts of the interval. This error is what we estimate in what follows.

We decompose

$$\begin{aligned} \int _{-\vartheta _{h,k}'}^{\vartheta _{h,k}''}=\int _{-\frac{1}{kN}}^{\frac{1}{kN}}-\int _{-\frac{1}{kN}}^{-\frac{1}{k(k_1+k)}}-\int _{\frac{1}{k(k_2+k)} }^{\frac{1}{kN}} \end{aligned}$$

and we want to estimate the contributions to the error terms from the last two integrals in the same way as before, the only difference being that on these other parts of the Farey intervals we have

$$\begin{aligned} \mathrm{Re}(z)=\frac{k}{n}, \quad \mathrm{Re}\left( \frac{1}{z} \right) <k \quad \text {and}\quad |z|^2\ge \frac{k^2}{n^2}. \end{aligned}$$

In this way, we get that this contribution is less than

$$\begin{aligned} \sqrt{2}e^{2\pi +\frac{\pi }{8}}\cot \left( \frac{\pi }{2c} \right) n^{-\frac{1}{2}} \frac{ 1+\log \left( \frac{c-1}{2} \right) }{\pi \left( 1-\frac{\pi ^2}{24}\right) }\sum k^{-\frac{1}{2}}. \end{aligned}$$

Now, since \( \delta _{c,k,r}\le \frac{1}{16}, \) the exact same bounds (multiplied by 2 for \( \sum _5 \)) hold for \( \sum _5 \) and \( \sum _6. \)

4.3.4 Errors introduced by integrating along the smaller arc

This is very easy and goes along the same lines as in [8, p. 939]. The contribution to \( \sum _2 \) is less than

$$\begin{aligned} 2\sqrt{2}\left( \frac{4}{3}+2^{\frac{5}{4}}\right) e^{2\pi +\frac{\pi }{8}} \cot \left( \frac{\pi }{2c} \right) \frac{1+\log \left( \frac{c-1}{2} \right) }{\pi \left( 1-\frac{\pi ^2}{24}\right) }n^{\frac{1}{4}}, \end{aligned}$$

the precise same bounds (multiplied by 2 for \( \sum _5 \)) being valid for \( \sum _5 \) and \( \sum _6. \) Putting together all these bounds, we complete the proof of Theorem 1. \(\square \)

More than the result in itself, the following is a perfect example of Theorem 1 at play and it illustrates why the general reasoning fails for moduli \( c<7. \)

Proof (of Theorem 2)

As it can be readily seen, the argument of the leading hyperbolic sine term is the same in the sums \( B_{1,5,5}, \) \(B_{2,5,5}\) and \( D_{1,5,1}, \) and equals \( \sinh \left( \frac{\pi \sqrt{n}}{5}\right) . \) Therefore, to establish the sign of the rank difference \( \overline{N}(a,5,n)-\overline{N}(b,5,n), \) we need to compute the leading coefficients of these terms. Without much effort, and making use of several known properties of the Dedekind sums (see, e.g., [4, Chapter 3.7]), we compute

and

while

$$\begin{aligned} 2\sqrt{\frac{2}{n}}D_{1,5,1}(-n,0)=\frac{2}{\sqrt{n}}\tan \left( \frac{\pi }{5}\right) . \end{aligned}$$

Bounding the error terms as described before, a numerical check in Mathematica shows that the result holds for all values \( n>40, \) with the exceptions presented in Table 1.

One should also note that, although our approach cannot establish identities, a simple trigonometric computation shows that

$$\begin{aligned} \left( 1+\frac{1}{\sqrt{5}} \right) \left( 1-\cos \left( \frac{4\pi }{5}\right) \right) \tan \left( \frac{\pi }{5} \right) + \frac{1}{\sqrt{5}}\left( 1-\cos \left( \frac{8\pi }{5}\right) \right) \tan \left( \frac{2\pi }{5}\right) =0, \end{aligned}$$

which means that the main asymptotic contributions of \( \overline{N}(a,5,5n+d)\) and \( \overline{N}(b,5,5n+d)\) coincide and is, consequently, an indication of the fact that \( \overline{N}(a,5,5n+d) = \overline{N}(b,5,5n+d)\) holds \( a=0,~b=2 \) and \( d=2. \) This result was already proven by Lovejoy and Osburn, see eq. (12) from [21, Theorem 1.2]. \(\square \)

Remark 10

For \( c=6 \) we can also give an alternative proof to all the inequalities listed in Theorem 1.2 from [18]. Indeed, we have

$$\begin{aligned}&\sum _{n=0}^{\infty }(\overline{N}(a,6,n)-\overline{N}(b,6,n))q^n\\&\quad =\frac{1}{3}\rho _1(a,b,6) \mathcal {O}\left( \frac{1}{6};q\right) +\frac{1}{3}\rho _2(a,b,6)\mathcal {O}\left( \frac{1}{6};q\right) +\frac{1}{6} \mathcal {O}\left( \frac{1}{2};q\right) \\&\quad =\frac{1}{3}\rho _1(a,b,6) \mathcal {O}\left( \frac{1}{6};q\right) +\frac{1}{3}\rho _2(a,b,6)\mathcal {O}\left( \frac{1}{6};q\right) +O(n^\varepsilon ), \end{aligned}$$

where the second identity follows from the fact that \( O(-1;q)=O(n^{\varepsilon }), \) which we recall from the discussion made in the proof of Theorem 1 for the case \( 2\mid c \). The main contribution of the first term equals

$$\begin{aligned} \rho _1(a,b,6)A\left( \frac{1}{6};n \right) \sim \frac{4}{c\sqrt{n}}\tan \left( \frac{\pi }{3} \right) \left( \cos \left( \frac{\pi a}{3}\right) -\cos \left( \frac{\pi b}{3} \right) \right) \sinh \left( \frac{\pi \sqrt{n}}{3}\right) , \end{aligned}$$

while that of the second term equals

Since for \( j=2 \) the arguments appearing in \( \rho _2(a,b,6) \) are no longer in the interval \( [0,\pi ), \) on which the cosine function is decreasing, the inequalities now depend, additionally, on the values of a and b. While our line of reasoning cannot be used to prove the identities from [18, Theorem 1.4], it clearly suggests that they should hold true, in light of the fact that the main hyperbolic sines are equal. In passing, we also correct Example 1 from [10], in which some misprints seem to have occurred, the correct asymptotic values for \( A\left( \frac{1}{3};n \right) \) being those given here. In particular, Theorem 4 is now a straightforward consequence of these asymptotics.

Further, the proof of Theorem 3 follows on noting that from identity (4) we obtain

$$\begin{aligned} N(0,2,n)-N(1,2,n)=\mathcal {O}(-1;q), \end{aligned}$$

and on invoking the next result. The numerical check is in this case greatly simplified.

Lemma 1

The coefficients (other than the leading term) of the series

$$\begin{aligned} \mathcal {O}(-1;q)=1+2q-4q^2+8q^3-10q^4+\cdots \end{aligned}$$

are alternating in sign. What is the same, the coefficients (other than the leading term) of the series

$$\begin{aligned} \mathcal {O}(-1;-q)=1-2q-4q^2-8q^3-10q^4-\cdots \end{aligned}$$

are negative.

Proof

Summing according to the largest part of the overpartition, we obtain, cf. eq. (3.1) from [20],

$$\begin{aligned} \mathcal {O}(z;q)=1+2q+z^{-1}\sum _{n=1}^{\infty }\frac{(-q/z)_n(zq)^n(1+zq)}{(q/z)_n}. \end{aligned}$$
(12)

Setting \( z=-1 \) and \( q\mapsto -q \) in (12), we have

$$\begin{aligned} \mathcal {O}(-1;-q)=1-2q-\sum _{n=1}^{\infty }\frac{(-q)_nq^n(1+q)}{(q)_n}=1-2q-\sum _{n=1}^{\infty }\prod _{k=1}^n\frac{1+q^k}{1-q^k}(1+q)q^n, \end{aligned}$$

and it is clear that the coefficients of the sum subtracted on the right, expressed as a q-series, are all positive. \(\square \)

Using the fact (see, e.g., the proof of Theorem 5.6 from [20, p. 330]) that

$$\begin{aligned} \mathcal {O}(i;q)=1+2\sum _{n=1}q^{n^2}, \end{aligned}$$

Theorem 5 becomes an easy exercise, which we leave to the interested reader (this was also proven, by a different and independent approach, in [14]).