The topologically twisted index of $\mathcal N=4$ SU($N$) Super-Yang-Mills theory and a black hole Farey tail

We investigate the large-$N$ asymptotics of the topologically twisted index of $\mathcal N=4$ SU($N$) Super-Yang-Mills (SYM) theory on $T^2\times S^2$ and provide its holographic interpretation based on the black hole Farey tail. In the field theory side, we use the Bethe-Ansatz (BA) formula, which gives the twisted index of $\mathcal N=4$ SYM theory as a discrete sum over Bethe vacua, to compute the large-$N$ asymptotics of the twisted index. In a dual $\mathcal N=2$ gauged STU model, we construct a family of 5d extremal solutions uplifted from the 3d black hole Farey tail, and compute the regularized on-shell actions. The gravitational partition function given in terms of these regularized on-shell actions is then compared with a canonical partition function derived from the twisted index by the inverse Laplace transform, in the large-$N$ limit. This extends the previous microstate counting of an AdS$_5$ black string by the twisted index and thereby improves holographic understanding of the twisted index.


Introduction
Microscopic origin of black hole entropy has been one of the most important questions in quantum gravity since Bekenstein and Hawking found that a black hole has macroscopic entropy proportional to the area of its event horizon [2,3]. In this context, microstates associated with the entropy of an asymptotically flat 1 4 -BPS black hole in 5d N = 4 supergravity have been successfully addressed by counting supersymmetric ground states of the corresponding D-brane world volume theory in the pioneering work [4]. For black holes in asymptotically Anti-de Sitter (AdS) backgrounds, the first successful microstate counting has been done by investigating asymptotic symmetries of the near-horizon limit of a 3d Bañados-Teitelboim-Zanelli (BTZ) black hole [5,6].
Recently, more systematic approach towards a microstate counting of black holes has been introduced for higher dimensional supersymmetric AdS black holes based on the AdS/CFT correspondence. In this approach initiated in [7], the Bekenstein-Hawking entropy of a supersymmetric AdS black hole is matched with the logarithm of the micro-canonical partition function (=the number of microstates) of a dual superconformal field theory (SCFT) on the conformal boundary of the bulk, in the large-N limit where N denotes the rank of the gauge group. Precise matching between the two quantities, namely the black hole entropy and the logarithm of the micro-canonical partition function of a dual SCFT, implies that microstates associated with the entropy of a supersymmetric AdS black hole correspond to the ensemble of BPS states in a dual SCFT counted by a micro-canonical partition function.
In the above mentioned black hole microstate counting, one of the key techniques is supersymmetric localization [8]. Thanks to this powerful technique, grand-canonical partition functions of various SCFTs could be computed [9] and then used to derive micro-canonical partition functions that count microstates associated with dual AdS black holes as explained above: to be specific, the logarithm of a grand-canonical partition function is Legendre transformed with respect to chemical potentials to yield the logarithm of a micro-canonical partition function that matches dual AdS black hole entropy (this process is called I-extremization [7,10]). In particular, grand-canonical partition functions of various SCFTs defined on curved manifolds with a topological twist have been studied extensively in this context of black hole microstate counting, since conformal boundaries of numerous AdS black holes, where dual SCFTs live, are given as curved manifolds with a topological twist. These grand-canonical partition functions of topologically twisted SCFTs are dubbed as a topologically twisted index [9]. As a first concrete example, the topologically twisted index of 3d ABJM theory on S 2 × S 1 has been computed in the large-N limit. Then the micro-canonical partition function, which was derived from the twisted index by the I-extremization described above, successfully counted microstates associated with the entropy of a dual 1 4 -BPS magnetic AdS 4 black hole in 4d N = 2 gauged STU model [7]. See [11][12][13][14][15][16][17] and [18][19][20][21] for other examples in AdS 4 /CFT 3 and AdS 6 /CFT 5 respectively.
Of particular interest is the topologically twisted index of N = 4 SU(N ) Super-Yang-Mills (SYM) theory on T 2 × S 2 [9,22]. The twisted index of N = 4 SYM theory was first computed in the Cardy-like limit where the modular parameter of the torus T 2 , namely τ , is sent to |τ | → 0 + with fixed arg τ ∈ (0, π), (1.1) by the Bethe-Ansatz (BA) formula that gives the index as a discrete sum over Bethe vacua [23]. The resulting Cardy-like asymptotics of the twisted index was then matched in the large-N limit with the central charge associated with the AdS 3 × S 2 near-horizon geometry of a dual magnetic AdS 5 black string in 5d N = 2 gauged STU model. In this first investigation, however, the twisted index was not used to count microstates associated with the entropy of a dual AdS 5 black string. It is later in [24][25][26][27] that the Legendre transform of the logarithm of the twisted index (I-extremization) was matched in the large-N after the Cardy-like limit with the entropy of a 4d black hole obtained by the Kaluza-Klein (KK) compactification of a dual AdS 5 black string along the string direction [28]. Since the entropy of a 4d black hole from the KK compactification is identical to that of an original AdS 5 black string [29], this shows that the twisted index of N = 4 SYM theory can be used to count microstates associated with the entropy of a dual AdS 5 black string through I-extremization. Refer to [30] for a recent analysis of log N corrections, which are sub-leading to N 2 -leading order contributions discussed in the literature [23][24][25][26][27].
In this paper, we explore the twisted index of N = 4 SU(N ) SYM theory and its holography in the large-N limit with a finite modular parameter τ instead, which is a more appropriate parameter regime in the context of AdS/CFT correspondence. In due process, we will address the following two issues overlooked in the Cardy-like limit.
First, the BA formula for the twisted index of N = 4 SYM theory on T 2 × S 2 contains multiple contributions to the twisted index with the SL(2,Z) modular structure [31], whose holographic duals have not yet been fully understood. The black hole microstate counting in [24][25][26][27] has been done by focusing on a particular contribution among them, which is expected to be dominant in the Cardy-like limit. Complete holographic understanding of the twisted index in the pure large-N limit with a finite modular parameter τ is therefore still an open problem. Note that a similar problem for the superconformal index of N = 4 SYM theory has recently been addressed by considering orbifold solutions in the gravity side [32], whose field theory duals have been investigated under the generalized Cardy-like limit where a chemical potential approaches a rational number [33].
We resolve this first issue by providing a family of gravity duals for multiple contributions to the BA formula of the twisted index. This family of gravity duals are obtained by imposing the extremal limit on the SL(2,Z) family of black holes [34] and then uplifting it to extremal solutions of 5d N = 2 gauged STU model. The SL(2,Z) family of black holes was dubbed as a black hole Farey tail in [1].
Another important remark is that the holographic relation between the twisted index of N = 4 SYM theory on T 2 × S 2 and a dual AdS 5 black string entropy has been investigated by treating a modular parameter of the torus T 2 , τ , as a chemical potential associated with the momentum along the string direction [24][25][26][27]. This means, in the step of I-extremization where the logarithm of a twisted index is Legendre transformed with respect to chemical potentials, a modular parameter τ is fixed in terms of a string momentum. Consequently, the logarithm of a micro-canonical partition function is matched with a dual black string entropy in micro-canonical ensemble with a fixed τ . Therefore one cannot explore holographic duals of interesting modular properties of the twisted index involving T and S transformations of a modular parameter τ [31] in this approach. It is then natural to ask if the twisted index and its holographic dual can be compared with each other in canonical ensemble where τ is treated as a free modular parameter.
We tackle this second issue by evaluating the regularized on-shell action S E reg of the aforementioned family of gravity duals as a function of a modular parameter τ , rather than computing the entropy in terms of a string momentum following [24][25][26][27]. The gravitational partition function is then approximated as a sum of exp −S E reg over these gravity duals. The resulting gravitational partition function matches the canonical partition function derived from the twisted index by the inverse Laplace transform treating τ as a free modular parameter.
This paper is organized as follows. In the remaining part of introduction, we summarize the main results. In section 2, we review the BA formula of the topologically twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 , and compute the large-N asymptotics of the twisted index based on it. Then we derive a canonical partition function from the twisted index by the inverse Laplace transform treating τ as a free modular parameter of the torus T 2 . In section 3, we construct a family of 5d extremal solutions in a dual N = 2 gauged STU model and compute the corresponding regularized on-shell actions. A gravitational partition function is then easily approximated in the large-N limit. In section 4, we compare the canonical partition function from the field theory side with the gravitational partition function in the large-N limit, and thereby improve holographic understanding of the twisted index of N = 4 SU(N ) SYM theory.

Summary of the main results
The BA formula gives the topologically twisted index of N = 4 SU(N ) SYM theory on T 2 ×S 2 as a sum over Bethe vacua, or solutions to the Bethe Ansatz Equations (BAE). The result reads Z(τ, ∆ a , n a ) = n|N n−1 r=0 Z {m,n,r} (τ, ∆ a , n a ) + Z non-st (τ, ∆ a , n a ), (1.2) where τ is a modular parameter of T 2 and ∆ a , n a are chemical potentials and magnetic charges associated with flavor symmetries respectively. Z {m,n,r} denotes the contribution from a 'standard' BAE solution labelled by three integers {m, n, r} with N = mn and r ∈ {0, 1, · · · , n − 1} and Z non-st denotes the contribution from all the other 'non-standard' BAE solutions. Refer to subsection 2.1 for details. In the following subsections, we focus on a standard contribution and leave a conjecture for a non-standard one, which has not yet been investigated thoroughly.
In the large-N limit, we found the large-N asymptotics of a standard contribution Z {m,n,r} for generic complex chemical potentials ∆ a ∈ C, which is computed for the first time to the best of our knowledge. For real chemical potentials ∆ a ∈ R, the results are simplified as upto sub-leading orders of the form o(N 2 ), ignoring pure imaginary terms defined modulo 2πiZ. Note that the large-N asymptotics of log Z {m,n,r} is given for an infinite m = O(N 0 ) and for a finite m = O(N 0 ) separately. For the case with a finite m, a finite fraction s is chosen to minimize an integer p determined by the relation r−ms n = q p with gcd(p, q) = 1. Refer to subsection 2.2 for details, in particular for the large-N asymptotics with generic complex chemical potentials ∆ a ∈ C.
The canonical partition function is then given from the twisted index by the inverse Laplace transform in the large-N limit as where we have treated τ as a free modular parameter. Refer to subsection 2.3 for details, in particular we explain there how the large-N asymptotics of various contributions to the twisted index through the BA formula (1.2) can be labelled by a set of integers (c, d) ∈ N × Z rather than by three integers {m, n, r}.
The family of extremal solutions to the BPS equations of 5d N = 2 gauged STU model (C.7), whose element is labelled by (c, d) ∈ N × Z with gcd(c, d) = 1, is given as e 2hg(x,y) (dx 2 + dy 2 ), where ρ + = i 2(cτ +d) and (t , φ ) coordinates are periodic as This family of extremal solutions is constructed based on the black hole Farey tail [1,34,35], and expected to arise in the near-horizon limit of a supersymmetric magnetically charged AdS 5 black string. Refer to subsections 3.1 and 3.2 for details.
The regularized Euclidean on-shell actions of the above extremal solutions (1.5) read for Σ g = S 2 (g = 0). The gravitational partition function is then approximated in the large-N limit (or in the small Newton's constant limit) as 2 Topologically twisted index on T 2 × S 2 In [9,22], the path integral for the grand-canonical partition function of N = 4 SU(N ) SYM theory on T 2 × S 2 with a topological twist on S 2 , dubbed as the topologically twisted index, was reduced to a matrix integral via supersymmetric localization [8]. The resulting matrix integral was then rewritten by the BA formula, which simplifies the matrix integral for the twisted index into a discrete sum over Bethe vacua. Based on the BA formula, the twisted index of N = 4 SYM theory has been studied mainly in the Cardy-like limit (1.1), where the relation with a dual central charge [23] and a dual black hole entropy [24,27] have been addressed.
In this section, we investigate the large-N asymptotics of the twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 instead, which is more appropriate to be compared with holographic duals in the context of AdS/CFT correspondence. To begin with, in subsection 2.1, we briefly review the BA formula of the twisted index. In subsection 2.2, we explore the large-N asymptotics of the twisted index based on the BA formula. In subsection 2.3, we derive a canonical partition function from the twisted index in the large-N limit by the inverse Laplace transform treating τ as a free modular parameter, which will then be identified with a dual gravitational partition function in section 4.

The Bethe Ansatz formula
The matrix integral for the twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 is given as [9,22,23]

and we have defined the prefactor A as
. (2.2) Refer to Appendix A for definitions of elliptic functions and their properties. In (2.1), τ is the modular parameter of a torus T 2 . Chemical potentials ∆ a and magnetic fluxes n a are associated with flavor symmetries of the theory and satisfy the constraints where the former is from the invariance of a superpotential under flavor symmetries and the latter is from supersymmetry. The holonomies of a gauge field in the vector multiplet along both temporal and spatial cycles of T 2 , namely They parametrize the localization locus together with gauge magnetic fluxes m i , which explains why the formula (2.1) contains both an integral over holonomies and a sum over gauge magnetic fluxes. The integration contour C for holonomies is chosen to yield Jefferey-Kirwan (JK) residues at a certain subset of poles of 1-loop contribution from chiral multiplets in the SYM theory. See [22] for more details and [36,37] for previous application of JK residues in the matrix model of 2d elliptic genera. The matrix integral form of the twisted index (2.1) can be rewritten by introducing a contour integral for w as [23] with a large positive integer M and the integration contour B encircling the origin w = 0. Here the BA operator Q i is defined as where we have introduced a parameter λ as w = e 2πiλ . A set of holonomies {u j } is a shorthand notation of {u j | j = 1, · · · N }. The integral in (2.6) can be evaluated by picking residues of the integrand determined by the Bethe-Ansatz Equations (BAE), namely The twisted index (2.6) then reduces to a sum over Bethe vacua, or BAE solutions, as (2.9) in terms of the prefactor (2.2) and the Jacobian , (2.10) We call (2.9) the BA formula of the twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 .
Note that the factor of N ! in the denominator of (2.6) is canceled by identifying BAE solutions equivalent under the permutation of holonomies {u i }.
The BA formula (2.9) is incomplete, however, for the following two reasons: • The BA formula (2.9) does not take continuous family of BAE solutions into account. Note that the BA formula (2.9) is derived by applying the Cauchy's integral formula to (2.6) under the assumption that all the solutions to the BAE (2.8) are isolated. As it has been observed in the literature [38][39][40], however, the BAE (2.8) have continuous family of solutions and therefore the BA formula (2.9) has to be refined to incorporate their contributions.
• The BA formula (2.9) does not clarify 'relevant' BAE solutions that contribute to the twisted index. Note that the discrete sum in (2.9) should be taken for solutions to the BAE (2.8) enclosed by the contour C only. The contour C is introduced rather implicitly in (2.1) to capture the JK residues, however, and therefore it is not trivial to decide if a given BAE solution truly contributes to the twisted index through the BA formula (2.9).
To circumvent the first issue about continuous family of BAE solutions, in this paper we focus on the contribution from isolated BAE solutions to the twisted index so that the BA formula (2.9) can be used without modifications. In particular, we focus on standard BAE solutions [31,38,39], which we will review in the remaining part of this subsection. Then, to take care of the second issue about 'relevant' BAE solutions that contribute to the twisted index, we assume that any standard BAE solution is enclosed by the contour C in (2.1) and therefore contributes to the twisted index. We leave more complete analysis of the BA formula that resolves the above mentioned issues for future research.

Standard BAE solutions
The first step to compute the twisted index using the BA formula (2.9) is to find the most general solutions to the BAE (2.8). Since the BAE is a highly involved system of transcendental equations, however, it is difficult to derive its general solutions. Hence we focus on a particular set of BAE solutions found in [31] and dubbed as standard solutions in [38,39], namely labelled by three integers {m, n, r} where m and n are positive divisor of N such that N = mn and r ∈ {0, · · · , n − 1}. In (2.11),ū is introduced to satisfy the SU(N ) constraint (2.5) and we have also introduced a double-index notation with the identification u N = u 0 . Each standard BAE solution {u i } {m,n,r} distributes holonomies u i 's evenly over the torus T 2 and thereby define a freely acting orbifold T 2 /Z m × Z n . All the other solutions to the BAE (2.8) are called non-standard [38,39]. The contribution from various standard BAE solutions to the twisted index through the BA formula (2.9) has been written explicitly in [31]. The result can be summarized as where Z {m,n,r} (τ, ∆ a , n a ) stands for the contribution from a particular standard BAE solution labelled by {m, n, r} (2.11) in the BA formula (2.9), namely [31] Z {m,n,r} (τ, ∆ a , n a ) = (2.14) Here we have introduced the modular parameter of a freely acting orbifold T 2 /Z m × Z n as τ = mτ + r n . (2.15) We have also introduced a shorthand notation for the Jacobian determinant of a standard BAE solution as H {m,n,r} (τ, ∆ a ) ≡ H({u i } {m,n,r} ; τ, ∆ a ).
Following [31], one can rewrite the Jacobian determinant H {m,n,r} in (2.14) by factoring out its universal diagonal element. We start from the matrix elements of the Jacobian (2.10) of a standard BAE solution (2.11), namely (µ, ν ∈ {1, · · · , N − 1}) where hatted indices are introduced following the double-index notation (2.12) as (µ, ν) = (nĵ µ +k µ , nĵ ν +k ν ) and we have defined the G-function as The matrix elements (2.16) imply that the Jacobian determinant H {m,n,r} is related to the determinant of an (N − 1) × (N − 1) submatrix as H {m,n,r} (τ, ∆ a ) = N det 1 2πi Using the identity [31] m−1 ĵ =0 The expressions (2.14) and (2.22) are equivalent to each other and give the contribution to the twisted index from a standard BAE solution -labelled by {m, n, r} as (2.11) -through the BA formula (2.9) in terms of elliptic functions.
The standard contribution Z st in (2.13a) has received more attention compared to the non-standard contribution Z non-st since it can be written explicitly as (2.13b) equipped with (2.14) or equivalently with (2.22) so one can explore its property more concretely. In particular, Z st has been investigated mainly in the Cardy-like limit (1.1), where the asymptotic expansion of Z {m,n,r} (2.14) was computed and a dominant sector Z {1,N,0} was compared with an appropriate holographic dual [23,24,27].
In this paper, we also focus on the standard contribution Z st (2.13b) but in the large-N limit with a finite τ , since it is more appropriate to be compared with holographic duals in the context of AdS/CFT correspondence as pointed out in the introduction. In the following subsection, we therefore investigate the large-N asymptotics of a particular standard contribution Z {m,n,r} (2.14), or (2.22), that composes the total standard contribution Z st through (2.13b).

Large-N asymptotics
Here we expand a particular standard contribution to the twisted index, namely Z {m,n,r} given in terms of elliptic functions as (2.14) or equivalently as (2.22) in the large-N limit. We will investigate the 'basic' sector Z {1,N,0} first, and then move on to general sectors Z {m,n,r} .

Basic contribution
For the basic sector with {m, n, r} = {1, N, 0}, we use the logarithm of (2.22) (2.23) To evaluate the large-N asymptotics of (2.23), first we derive using the asymptotic expansions of elliptic functions (A.6) and (A.11). See (A.9) for the definition of the 'tilde' component of chemical potentials, namely∆ a . For ∂ ∆a in (2.24b) to be well-defined, we assume generic chemical potentials where Re ∆ a − cot(arg τ ) Im ∆ a / ∈ Z. We have also introduced η c,s for generic chemical potentials as 1 from the constraint on chemical potentials 3 a=1 ∆ a ∈ Z in (2.3). Next we consider the Jacobian determinant in (2.23). In [41], it has been shown analytically using the Gershgorin Circle Theorem that the Jacobian determinant scales like O(N 0 ) for a finite but small enough |τ |. For a general finite τ , the authors used numerical analysis to support the same scaling We use this result to provide an upper bound to the large-N asymptotics of the Jacobian determinant in (2.23). Substituting (2.24) and (2.26) into (2.23) then gives the large-N asymptotics of the basic sector Z {1,N,0} as Note that linear N sub-leading order terms are pure imaginary in (2.27) and therefore they affect the phase of the large-N asymptotics of Z {1,N,0} at most. It is remarkable that the N 2 -leading order in (2.27) does not have any sub-leading corrections of the form ∼ N 2 τ # with a non-negative integer # in the Cardy-like limit (1.1). This is not obvious from the Cardy-like asymptotics computed in [23,31], which is the same as the first term of (2.27) with a simple replacement N 2 → N 2 − 1, since they did not keep track of sub-leading orders in the Cardy-like limit. Thanks to this result, the microstate counting of a dual AdS 4 black hole from the KK compactification by the twisted index in the Cardy-like limit [24][25][26][27] can be reproduced in the large-N limit with a finite τ .

Other contributions
Next we investigate the large-N asymptotics of a general sector Z {m,n,r} . In this case, we use the logarithm of (2.14) The Jacobian determinant in (2.28) is bounded from above in the large-N limit as 2 ( To extract the N 2 -leading order from the expression (2.30), we split various configurations of three integers {m, n, r} into two cases based on the finiteness of m in the large-N limit.

Infinite m
First we consider the case where m is infinite in the large-N limit as One subtle issue is that (2.29) does not exclude the possibility for the Jacobian determinant to vanish asymptotically in the large-N limit. In that case, particularly when it approaches zero exponentially fast as ∼ e −N 2 , the logarithm of the Jacobian determinant may contribute to the N 2 -leading order. We assume this is not the case for generic chemical potentials ∆a.
The goal is to figure out the N 2 -leading order of log Z {m,n,r} (2.30) in the large-N limit under the condition (2.31). To begin with, we derive using the quasi-periodicity (A.3), where the integer j a is defined as Substituting the product forms (A.1) and (A.2) into (2.32) then gives .

(2.34)
Using the upper bound for the infinite product term given in (B.4), one can estimate the logarithm of (2.34) as We can simplify (2.36) further as (2.37) Note that one can determine the N 2 -leading order from the expression (2.36) or (2.37) since the last term of order O(N log N, n 2 ) does not contribute to the N 2 -leading order for an infinite m satisfying the condition (2.31).

Finite m
The case with a finite m is more subtle to explore in general. To begin with, we introduce a finite fraction s in terms of which the modular parameter of an orbifold (2.15) is written as where we have also introduced relatively prime integers p and q such that 0 ≤ q < p. Note that (s, p) ∈ 1 mp Z × N is not uniquely determined for a given configuration {m, n, r} with a finite m though.
To fix (s, p) ∈ 1 mp Z × N uniquely for a given configuration {m, n, r} with a finite m, we choose a finite fraction s that minimizes a natural number p determined by the relation (2.38).
In this way, a natural number p is uniquely determined. Then we further assume which is an extra condition we need to explore the large-N asymptotics of a general sector Z {m,n,r} with a finite m. Under this assumption (2.39), one can prove that there is a unique finite fraction s that minimizes a natural number p determined by the relation (2.38) for a given configuration {m, n, r} with a finite m: where the second case contradicts that s and s are finite. As a result, (s, p) ∈ 1 mp Z × N is uniquely determined for a given configuration {m, n, r} with a finite m. Several examples are as follows: .
It is subtle to test if, for any given configuration of {m, n, r} with a finite m, one can always find a finite fraction s such that a natural number p determined by the relation (2.38) satisfies the condition (2.39) in the large-N limit. For simplicity, we focus on sectors Z {m,n,r} that allow for such s and leave a complete analysis for future research.
As we have done for the case with an infinite m (2.31), here we investigate the N 2 -leading order of log Z {m,n,r} (2.30) in the large-N limit under the condition (2.39) with a finite m. To begin with, using the SL(2,Z) transformation of elliptic functions (A.5) with . (2.43) Using the quasi-periodicity (A.3), (2.43) can be rewritten as , where the integer k a is defined as Substituting the product forms (A.1) and (A.2) into (2.44) then gives (2.46) Using the upper bound for the infinite product term given in (B.7), one can rewrite the logarithm of (2.46) as

Consistency under modular transformations
In [31], the standard contribution Z st to the twisted index (2.13b) has been investigated in detail and, in particular, its modular property as a weak Jacobi form was found. To be specific, it has been shown that generators of modular transformations, namely permute standard contributions Z {m,n,r} (2.14) as where g = gcd(n, r) and an integer d is determined by a relation (r In (2.50), the third entry in the three-integer notation {·, ·, ·} is defined modulo the second entry. Due to the permutation (2.50), the total standard contribution Z st (2.13b) satisfies Here we will check if the large-N asymptotics (2.36) and (2.48) are consistent with modular properties among various sectors given in (2.50). First we consider the T -transformation (2.50a). Note that the orbifold modular parameter τ (2.15) transforms in the same way under the T -transformation and the shift of r by m as Using this property, one can easily check that the large-N asymptotics of log Z {m,n,r} , both (2.37) for an infinite m and (2.48) for a finite m, satisfy the T -transformation (2.50a).
Next we consider the S-transformation (2.50b). For simplicity, let us focus on the case with r = 0 that gives g = n, d = 0, and b = −1 in (2.50b). The S-transformation (2.50b) then reduces to

Canonical partition function
Combining (2.13) with (2.37) and (2.48), we obtain the twisted index in the large-N limit (leaving non-standard contributions implicit). We will not compare the resulting twisted index directly with a gravitational partition function studied in section 3, however, because the former is a grand-canonical partition function and the latter corresponds to a canonical one. There are two different ways for a correct comparison: 1. In the field theory side, derive a canonical partition function from the twisted index. Then one can compare the resulting canonical partition function with a dual gravitational partition function given in section 3. This process is similar to the I-extremization [10], which was interpreted as relating micro-canonical and grand-canonical partition functions in [43]. One difference is that here we do not fix a modular parameter τ in terms of the associated string momentum, and therefore the resulting partition function is in canonical ensemble, not in micro-canonical ensemble.
2. In the gravity side, find a larger set of Euclidean BPS solutions dubbed as Euclidean black saddles [44], which includes a dual supersymmetric magnetically charged AdS 5 black string as a special case. One can use the regularized on-shell actions of these black saddles to derive a gravitational partition function in grand-canonical emsemble, which can be compared directly with the dual twisted index as a function of chemical potentials ∆ a . This has been done for a supersymmetric AdS 4 black hole and its dual topologically twisted ABJM theory in [44].
In this subsection we take the 1st approach and leave the 2nd approach for future research.
To begin with, we explain how the inverse Laplace transform gives a canonical partition function from the grand-canonical one in a simple toy model. For a given theory, one can write the grand-canonical partition function Z(τ, µ) schematically as (2.54) Here Q represents a set of charges that labels quantum states and µ stands for associated chemical potentials. τ is also a chemical potential but we will not fix this parameter through the inverse Laplace transform. Ω(τ, Q) is a canonical partition function labelled by a chemical potential τ and charges Q. Now, applying the Cauchy's integral formula to (2.54), one can derive Ω(τ, Q) from Z(τ, µ) as This is the inverse Laplace transform we will use to derive the canonical partition function from the grand-canonical one.

Canonical partition function from the twisted index
Now we come back to the original problem. The twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 , which is a grand-canonical partition function of the theory with a topological twist on S 2 , can be written as following (2.54) of the toy model. Here Q a 's are electric charges associated with the chemical potentials of flavor symmetries ∆ a . Note that τ will not be fixed in terms of a string momentum, which is different from the literature [24][25][26][27]: we leave it as a free modular parameter of the torus T 2 .
The canonical partition function is then given by the inverse Laplace transform as Since we do not know non-standard contributions to the twisted index Z non-st explicitly, we leave the calculation of Ω non-st (2.59b) for future research. Instead, we focus on contributions to the canonical partition function extracted from the standard contribution to the twisted index, namely Ω {m,n,r} (2.59a). We call Ω {m,n,r} the standard contribution to the canonical partition function. For simplicity, from here on we turn off electric charges Q a and use the shorthand notation Ω(τ, Q a = 0, n a ) → Ω(τ, n a ). (2.60) Since we focus on purely magnetic dual AdS 5 black strings in the following section 3, this will be enough for our purpose. We leave a similar analysis for generic cases with non-trivial electric charges and rotations based on [24,27,45] for future research.

Computing the canonical partition fuction
To evaluate the standard contribution to the canonical partition function Ω {m,n,r} using the integral (2.59a), we use the large-N asymptotics of Z  For these Dirac-delta functions not to vanish, which is required for a non-zero Ω {m,n,r} , the integer j a introduced in (2.33) must be given as where we have introduced ζ ∈ {±1, −3} as The constraint (2.64) is from the definition (2.33) and the constraint 3 a=1 ∆ a ∈ Z in (2.3). The condition (2.63) cannot be satisfied, however, since the RHS of (2.63) is not an integer for generic magnetic charges n a under the constraint (2.66b) Note that we have omitted pure imaginary terms in the effective action, since they are defined modulo 2πiZ so that we can ignore them when we focus on the N 2 -leading order in the large-N limit.
To evaluate the integral (2.66a), we use the saddle point approximation. The first step is to solve the following saddle point equation, where Λ is the Lagrange multiplier introduced to enforce the constraint 3 a=1 ∆ a ∈ Z in (2.3). One can solve the saddle point equation (2.67) using the relations where η mp,s ∈ {±1} is defined as (2.25). The second equation of (2.70a) is from the constraint on magnetic charges 3 a=1 n a = 2 in (2.3).
Next, substituting the saddle point (2.70a) into (2.66b) gives the effective action at the saddle point as S eff {m,n,r} (τ, ∆ a , n a ) = N 2 πi 4(mp) 2 (τ + s) n 1 n 2 n 3 1 − n 1 n 2 − n 2 n 3 − n 3 n 1 . (2.71) Since the effective action at the saddle point (2.71) becomes large in the large-N limit due to the condition (2.39), one can apply the saddle point approximation to the integral (2.66a) with N mp as a large control parameter. The result is given as log Ω {m,n,r} (τ, n a ) = N 2 πi 4(mp) 2 (τ + s) (2.72) In (2.72), a natural number mp and a finite fraction s ∈ 1 mp Z determine the precise N 2leading order in the logarithm of a particular {m, n, r} standard contribution to the canonical partition function, namely log Ω {m,n,r} . In particular, it is obvious that mp has to be finite for log Ω {m,n,r} to have a non-vanishing N 2 -leading order according to (2.72).

The total canonical partition function
The total canonical partition function is obtained by subsituting (2.65)  (2.73) Note that the first term in the exponent of the RHS scales like o(N 2 ) for an infinite m and therefore (2.73) is consistent with (2.65) as well as (2.72). The expression (2.73) is inconvenient to explore, however, since the large-N asymptotics of Ω {m,n,r} in (2.73) is labelled by (mp, s), which has to be determined case by case by minimizing an integer p introduced together with a fraction s in the relation (2.38) for a given configuration {m, n, r}.
To make the expression (2.73) more explicit, an important question is the following: what are the all possible values of finite (mp, s) ∈ N × 1 mp Z, each of which labels the large-N asymptotics of Ω {m,n,r} whose exponent has a non-vanishing N 2 -leading order in (2.73)? At first glance, it seems like for an arbitrary set of integers (c, d) ∈ N × Z, one can always find a configuration {m, n, r} such that the large-N asymptotics of Ω {m,n,r} is labelled by is an integer within the range r ∈ Z n = {0, 1, · · · , n − 1} as it should be. Since we are interested in the large-N limit, we may circumvent this issue by setting the rank N as any large natural number satisfying this condition. For example, for (c, d) = (2, 0), we may choose an even N for the configuration (2.75) then the condition r = N q+d c = N 2 ∈ Z N is satisfied with q = 1: for an even N , the large-N asymptotics of Ω {1,N,N/2} is labelled by (mp, s) = (c, d/c) = (2, 0). On the contrary, an odd N does not provide any {m, n, r} configuration whose corresponding contribution Ω {m,n,r} is labelled by (mp, s) = (c, d/c) = (2, 0) in the large-N limit.
This logic does not make sense, however, since we are interested in all the possible values of finite labels (mp, s) ∈ N × 1 mp Z for a 'given' rank N in (2.73): N cannot be chosen to yield a particular label (mp, s) = (c, d/c). Then we arrive at an weird conclusion: the factorization of the rank N affects the possible values of finite labels (mp, s) ∈ N × 1 mp Z even in the large-N limit. For example, just by replacing the rank originally given as an even number N with an odd number N + 1, we lose a particular standard contribution labelled by (mp, s) = (2, 0) in (2.73). This is definitely unnatural in the large-N limit.
We expect that this conundrum be resolved by exploring non-standard contributions. To be specific, we conjecture that for an arbitrary set of integers (c, d) ∈ N × Z, one may find a configuration {m, n, r} whose corresonding contribution Ω {m,n,r} is labelled by (mp, s) = (c, d/c) in the large-N limit as shown in (2.73), where the label (mp, s) is determined by minimizing an integer p in the relation (2.38); otherwise, if there is no such {m, n, r} configuration, the contribution labelled by (mp, s) = (c, d/c) comes from the non-standard contribution Ω non-st in (2.73). For example, according to this conjecture, the contribution labelled by (mp, s) = (2, 0) does exist for an odd N but it comes from the non-standard contribution Ω non-st in (2.73). Refer to [38] for both analytical and numerical evidence for this conjecture. 3 Based on the above conjecture, we can simplify the canonical partition function given in (2.73) further as Ω(τ, n a ) = c∈N d∈Z exp N 2 πi 4c 2 (τ + d/c) n 1 n 2 n 3 1 − n 1 n 2 − n 2 n 3 − n 3 n 1 + o(N 2 ) + Ω non-st (τ, n a ). (2.76) Note that the degeneracy for a given label (c, d) ∈ N × Z can be absorbed into o(N 2 ). The primed non-standard contribution Ω non-st means that some non-standard contributions in Ω non-st are factored out and included in the sum over (c, d) ∈ N × Z instead in (2.76). We will explore holographic duals of this canonical partition function (2.76) in the next section 3 and then compare the results in section 4.
In this section, we explore holographic duals of the canonical partition function derived from the twisted index in the previous section. To begin with, in subsection 3.1, we review a supersymmetric, magnetically charged AdS 5 black string solution of 5d N = 2 gauged STU model and its near-horizon geometry. In subsection 3.2, we construct a family of extremal solutions in 5d N = 2 gauged STU model, which includes the near-horizon limit of an AdS 5 black string reviewed in 3.1, based on the black hole Farey tail [1]. In subsection 3.3, we compute the regularized on-shell actions of these extremal solutions and then derive a gravitational on-shell action using them.

AdS 5 black strings in 5d N = 2 gauged STU model
We are interested in a supersymmetric magnetically charged AdS 5 black string solution of N = 2 gauged STU model reviewed in Appendix C, which is dual to the ensemble of BPS states of N = 4 SU(N ) SYM theory on T 2 × S 2 . One may find such solutions by solving the BPS equations (C.7) with the following magnetic black string ansatz (I ∈ {1, 2, 3}) ds 2 = −e 2f 1 (r) dt 2 + e 2f 2 (r) (dφ + Ω(r)dt) 2 + e 2f 3 (r) dr 2 + e 2f 4 (r) e 2hg(x,y) (dx 2 + dy 2 ), (3.1a) since the remaining equations of motion (C.4), (C.5), and (C.6) then follow automatically [46,47]. In this ansatz, we have generalized S 2 to a Riemann surface of genus g, namely Σ g , where we set κ = 1, 0, −1 for g = 0, g = 1, and g > 1 respectively for later purpose. The Riemann surface Σ g is supported by (x, y) coordinates, and we have defined h g and ω g on this Riemann surface as [44] e hg(x,y) = , , which satisfy dω g = e 2hg(x,y) dx ∧ dy. The asymptotically AdS 5 condition of an ansatz (3.1) can be summarized as in the asymptotic region r → ∞. Note that the conformal boundary of an ansatz (3.1) is given as R 1,1 × Σ g , which is replaced with T 2 × Σ g upon the Wick rotation t → −it E and the periodic identification of (t E , φ) coordinates. Hence, the Euclidean version of an ansatz (3.1) with g = 0 has the T 2 ×S 2 conformal boundary, where we have introduced the N = 4 SYM theory and computed its twisted index in section 2. This is consistent with that an AdS 5 black string solution of the form (3.1) with g = 0 is holographically dual to the ensemble of BPS states of N = 4 SYM theory on T 2 × S 2 .
A supersymmetric AdS 5 black string solution with generic magnetic charges p I has not yet been constructed analytically from the above ansatz (3.1). In [48], however, the corresponding AdS 3 × Σ g near-horizon solution that solves the BPS equations (C.7) was found. Replacing the Poincaré coordinates used in [48] with the near-horizon extremal BTZ coordinates used in [28], the AdS 3 × Σ g near-horizon solution can be rewritten as

4a)
The constants Π and Θ in (3.4) are defined in terms of magnetic charges as See Appendix C to check directly that (3.4) solves the BPS equations (C.7). Also refer to Appendix D for a coordinate transformation between the Poincaré coordinates and the near-horizon extremal BTZ coordinates. For some special configurations of magnetic charges, full analytic AdS 5 black string solutions have been constructed [49][50][51][52]. For example, when all three magnetic charges are identical as p I = − κ 3 and the Riemann surface is a hyperbolic plane as Σ g = H 2 (κ = −1), the corresponding magnetic black string solution is given from the ansatz (3.1) as [51,52] Here the function H(r) is given as -25 -See Appendix C to check directly that (3.6) solves the BPS equations (C.7). For the metric (3.6a) to be positive definite over r ∈ (0, ∞), we must impose the following constraints on parameters: It is straightforward to see that the full flow (3.6) matches the near-horizon solution (3.6) with identical magnetic charges in the near-horizon regime r → 0 under the identification ρ 2 + = −9q 0 and the following rescaling of coordinates: 3.2 Family of extremal solutions in 5d N = 2 gauged STU model In this subsection, we construct a family of extremal solutions to the BPS equations of 5d N = 2 gauged STU model (C.7). It can be obtained by replacing the near-horizon extremal BTZ part of (3.4a), namely with locally equivalent but globally distinguished extremal BTZ black holes. Note that the BPS equations (C.7) are local conditions and therefore they are not sensitive to the replacement of the near-horizon extremal BTZ part of (3.4a) given in (3.10) with any locally equivalent metric as pointed out in [28]. In 3.2.1, we construct a family of extremal BTZ black holes that will replace (3.10). This family of extremal BTZ black holes is obtained by imposing the extremal limit on the SL(2,Z) family of black holes, which was first constructed in [34] and then dubbed as a black hole Farey tail in [1]. Then in 3.2.2, we write down the family of 5d extremal solutions obtained by a simple replacement of (3.10) with the family of extremal BTZ black holes.
Since the periods of coordinates are determined in the Euclidean signature, we will construct a family of Euclidean BTZ black holes first by introducing various periods of (t E , φ) coordinates (t → −it E ) based on [1,34]. Then going back to the Lorentzian signature, we take the extremal limit to obtain the family of extremal BTZ black holes.

Periodic identifications in the Euclidean signature
The Euclidean BTZ metric obtained from (3.11) by the Wick rotation t → −it E reads There are two different ways to introduce periods of (t E , φ) coordinates in (3.13), and we will introduce both of them in order. First, we use the copmlex structure of a Euclidean BTZ black hole (3.13) in the asymptotic region to determine periods of (t E , φ) coordinates. To be specific, we set the conformal boundary of a Euclidean BTZ black hole (3.13) to be a torus with a complex structure specified by a modular parameter τ , and then the periods of (t E , φ) coordinates will be determined in terms of τ .
To begin with, consider the asymptotic region (ρ → ∞) of a Euclidean BTZ black hole (3.13): (3.14) From (3.14), it is clear that the conformal boundary of a Euclidean BTZ black hole is supported by a complex coordinate For the conformal boundary to be a torus, we should introduce two independent cycles along this complex coordinate w. The whole 3d space (3.14) will then be a solid torus, and therefore only one of the two cycles can be a contractible one. Following [1], we take 1. unique contractible cycle: w ∼ w + cτ + d (w ∼w + cτ + d), 2. a non-contractible cycle: where τ is a complex parameter and the integers a, b, c, d satisfy The conformal boundary now becomes a torus with a modular parameter aτ +b cτ +d , where we choose (3.16a) and (3.16b) as an A-cyle and a B-cycle respectively. In fact, since the complex structure is invariant under the SL(2,Z) transformation of a modular parameter, namely 18) we can say that the complex structure of a conformal boundary is specified by a modular parameter τ under the periodic identifications (3.16). One can construct various other non-contractible cycles in terms of linear combinantions of (3.16). In particular, taking a×(3.16a)−c×(3.16b) and −b×(3.16a)+d×(3.16b), one can obtain the fundamental cycles 2 . a non-contractible cycle: w ∼ w + 1 (contractible if (c, d) = (0, 1)), (3.19a) 2 . a non-contractible cycle: w ∼ w + τ (contractible if (c, d) = (1, 0)), (3.19b) respectively. For convenience, we write down the cycles (3.16a) and (3.19) in (t E , φ) coordinates as using (3.15). The last two fundamental cycles (3.20b) and (3.20c) determine periods of (t E , φ) coordinates. Note that (3.20b) is consistent with the known angular period (3.12). This time, we use the regularity of a Euclidean BTZ black hole (3.13) in the near-horizon region to determine periods of (t E , φ) coordinates. To begin with, consider the near-horizon region ρ = ρ + + x 2 (x ρ + ) upon which the Euclidean BTZ black hole (3.13) reads (3.21) For the near-horizon metric (3.21) to represent a smooth R 2 × S 1 horizon without a conical singularity at x → 0, (t E , φ) coordinates have to be periodically identified as where the spatial cycle is chosen to be consistent with the known angular period (3.12). These cycles (3.22) determine periods of (t E , φ) coordinates. Even though we have introduced periods of (t E , φ) coordinates in two different ways, the final results (3.20b,3.20c) and (3.22a,3.22b) must be consistent with each other. One of the fundemantal cycles, (3.20b), is already identical to the spatial cycle (3.22b). We then identify the unique contractible cycle (3.20a) to a thermal cycle (3.22a) [1,35]. The modular parameter τ and the BTZ parameters ρ ± are then related as Using (3.23), one can rewrite the periods of (t E , φ) coordinates given in (3.20b,3.20c) as 4 Note that not all integers (c, d) yield inequivalent periodic identifications through (3.24): a set of integers (c, d) ∈ N × Z c (Z c = {0, 1, · · · , c − 1}) with gcd(c, d) = 1 represents all the inequivalent periodic identifications. The family of Euclidean BTZ black holes constructed with different periodic identifications (3.24), however, is not labelled completely by a set of integers (c, d) ∈ N × Z c with gcd(c, d) = 1. This is because the metric (3.13) itself depends on ρ ± , which is a function of integers c and d through (3.23) for a given modular parameter τ . To be specific, even though (c, d) and (c, d + cZ) yield equivalent periodic identifications according to (3.24), they give different ρ ± values through (3.23) for a given modular parameter τ and therefore the corresponding Euclidean black holes are distinguished. Hence an element of the family of Euclidean BTZ black holes constructed with periodic identifications (3.24) should be labelled by (c, d) ∈ N × Z with gcd(c, d) = 1. 5 Note that we can still exclude the cases with a negative integer c since the Euclidean BTZ metric (3.13) is not sensitive to the sign flip (c, d) → (−c, −d) under (3.23) Consequently, we have constructed a family of Euclidean BTZ black holes, whose elements are labelled by a set of integers (c, d) ∈ N × Z with gcd(c, d) = 1 and satisfy the following properties: 1) they are locally given as (3.13) where ρ ± are given as (3.23), 2) they have a torus conformal boundary with a modular parameter τ, 3) their (t E , φ) coordinates are periodically identified as (3.24). (3.25)

Extremal limit in the Lorentzian signature
This time we discuss the extremal limit ρ + → ρ − . We cannot impose the extremal limit directly to the family of Euclidean BTZ black holes constructed as (3.25), however, since ρ + → ρ − is not allowed for a finite modular parameter τ under the relation (3.23). Here we circumvent this issue by going back to the Lorentzian signature, where one can take the extremal limit to obtain the family of extremal BTZ black holes. See the next subsection 3.2.2 for why we take the extremal limit.
To begin with, one can obtain a family of Lorentzian BTZ black holes from the Euclidean family (3.25) simply by replacing a Euclidean time coordinate t E with t E → it. An important consequence of this inverse Wick rotation is that a complex coordinate w and its conjugatē w from (3.15) become real as and they are not complex conjugates of each other. Hence τ andτ introduced in (3.16) cannot also be complex conjugate of each other. In the Lorentzian signature, we therefore usew →w andτ →τ instead. Consequently, the relation between a modular parameter and ρ ± given in (3.23) becomes in the Lorentzian signature. The periods of (t, φ) Lorentzian coordinates are given from (3.20b,3.20c), or equivalently from (3.24), as As a result, a family of Lorentzian BTZ black holes obtained from (3.25) by the inverse Wick rotation t E → it consists of various elements labelled by a set of integers (c, d) ∈ N × Z with gcd(c, d) = 1, which satisfy the following properties: 1) they are locally given as (3.11) where ρ ± is given as (3.27), 2) their (t, φ) coordinates are periodically identified as (3.28). (3.29) Now one can impose the extremal limit ρ + → ρ − , or equivalentlyτ → ∞ according to (3.27), to the family of Lorentzian BTZ black holes constructed as (3.29). Since the period of a time coordinate t given in (3.28) diverges under the extremal limit, however, we first take the following coordinate transformation from (t, φ, ρ) to (t , φ , r) [35,54]: The Lorentzian BTZ black hole (3.11) then reads (3.31) The periods of new (t , φ ) coordinates are given from the unprimed one (3.28) and the coordinate transformation (3.30) as In the above introduced primed coordinates, we take the extremal limit and obtain the family of extremal BTZ black holes. First, the parameter ρ + in (3.31) becomes ρ + = i 2(cτ + d) (3.33) in the extremal limit ρ + → ρ − (τ → ∞) from (3.27). Taking the extremal limit and using the relation (3.27) also simplify the periods of (t , φ ) coordinates (3.32) as Note that a primed time coordinate t has a finite period under the extremal limit.
Finally, the resulting family of extremal BTZ black holes consists of various elements labelled by a set of integers (c, d) ∈ N × Z with gcd(c, d) = 1, which satisfy the following properties: 1) they are locally given as (3.31) where ρ + is given as (3.33), 2) their (t , φ ) coordinates are periodically identified as (3.34). (3.35) Note that the metric of this family of extremal BTZ black holes (3.31) could be complex for a generic modular parameter τ due to the relation (3.33). We will not worry about this issue, however, since we are mainly interested in the regularized on-shell action in the Euclidean signature obtained by the Wick rotation t = −it E 6 , where complex bosonic fields are allowed in principle. See the next subsection 3.3 for a detailed calculation of the regularized on-shell action.

Family of 5d extremal solutions
The family of extremal solutions to the BPS equations of 5d N = 2 gauged STU model (C.7) is obtained by replacing the near-horizon extremal BTZ part of (3.4a), namely (3.10), with the family of extremal BTZ black holes constructed as (3.35). Each element of this family is labelled by a set of integers (c, d) ∈ N × Z with gcd(c, d) = 1, and given explicitly as e 2hg(x,y) (dx 2 + dy 2 ), Here ρ + is given as (3.33) and (t , φ ) coordinates are periodic as (3.34), and both of them depend on a label (c, d). See Appendix C to check directly that (3.36) solves the BPS equations (C.7). For the resulting family of 5d solutions (3.36) to correspond to the near-horizon limit of a family of supersymmetric magnetically charged AdS 5 black strings, we think that the extremal limit introduced in subsection 3.2.1, which yields the parameter relation (3.33) and periodicity of coordinates (3.34), is crucial. The family of supersymmetric magnetically charged AdS 5 black strings has not yet been constructed so this expectation is not confirmed yet: however, at least in the special case where all three magnetic charges are identical, the known full black string solution (3.6) does yield an extremal BTZ geometry in the near-horizon limit as observed in subsection 3.1 and thereby supports our expectation. Furthermore, a successful comparison in section 4 relies heavily on the extremal limit that gives (3.33) and (3.34). This explains why we focus on the family of 5d solutions in the extremal limit, namely (3.36) with (3.33) and (3.34).

Gravitational partition function
As mentioned in subsection 3.1, a supersymmetric magnetically charged AdS 5 black string solution of N = 2 gauged STU model is holographic dual to the ensemble of BPS states of N = 4 SU(N ) SYM theory on T 2 × S 2 . The AdS/CFT correspondence then implies that the gravitational partition function I exp[−S E reg,BS ] given in terms of the regularized onshell action of a black string solution S E reg,BS is supposed to match a dual canonical partition function derived from the twisted index by the inverse Laplace transform. Unfortunately, however, we have not yet figured out how to compute the regularized on-shell action of a full AdS 5 black string of the form (3.1) whose near-horizon limit corresponds to the family of 5d extremal solutions (3.36).
Hence we propose an alternative way to reproduce the canonical partition function from the gravitational side. To begin with, note that an AdS 3 × S 2 near-horizon solution (3.4) of N = 2 gauged STU model is holographically dual to the ensemble of BPS states of 2d SCFT on T 2 , arising from the Kaluza-Klein (KK) compactification of N = 4 SU(N ) SYM theory on S 2 (of T 2 ×S 2 ) [23]. Based on this duality, we expect that the gravitational partition function I exp[−S E reg,NH ] given in terms of the regularized on-shell action of a near-horizon solution S E reg,NH matches a dual canonical partition function derived from the elliptic genus. Since the 4d twisted index behaves like a 2d elliptic genus [31], this canonical partition function is equivalent to the one derived from the twisted index by the inverse Laplace transform, which is what we want to reproduce from the gravitational side.
Since we have extended a near-horizon solution (3.4) to the family of 5d extremal solutions (3.36), we will compute the regularized on-shell action of this family. The gravitational partition function derived from these on-shell actions will then be compared with the canonical partition function in section 4.
To compute the regularized on-shell action of the family of 5d extremal solutions (3.36), first we substitute (3.36) to the bulk action (C.1). The result is given under the Wick rotation t = −it E as where g (3) and R (3) represent the metric and the Ricci scalar of an extremal BTZ part, namely (3.31) in (3.36a). Note that we have introduced the 3d Newton's constant in the 2nd line of (3.37) as Next we substitute (3.36) to the Gibbons-Hawking-York (GHY) boundary action that gives where K (4) and K (2) are extrinsic curvatures on the boundaries of 5d extremal solutions (3.36a) and of an extremal BTZ metric (3.31) respectively. Note that we have used in the last equation of (3.39), which can be derived from the definition of an extrinsic curvature with n µ a normal vector on the boundary (see Appendix D of [55] for example). In (3.39), ∂g denotes a metric induced on a boundary. Now the regularized on-shell action of a family of 5d extremal solutions (3.36) reads from (3.37) and (3.39), where S E ct is designed to cancel divergent terms from the bulk action and the GHY term. Substituting the extremal BTZ part (3.31) of 5d extremal solutions (3.36a) into the 3d metric g (3) in the regularized on-shell action (3.42), one can compute (3.42) explicitly as where we have introduced the radial cutoff at r = r 0 (→ ∞). To remove the r 0 -divergence in (3.43), we introduce the counter term as 7 Substituting the counter term (3.44) into the regularized on-shell action into (3.43) and using the periods of Euclidean coordinates Here we have also used (3.38) in the second equation. Substituting vol[Σ g ] = 4π|g−1| and the expression of ρ + in terms of a modular parameter τ in the extremal limit, namely (3.33), we obtain the final expression for the regularized onshell action of a family of 5d extremal solutions (3.36). For a particular extremal solution labelled by (c, d) ∈ N × Z with gcd(c, d) = 1, the result is given as Note that this is different from the Bekenstein-Hawking entropy computed from the metric (3.36a) by a factor of − 1 2c , namely S E reg = − 1 2c S BH . 7 In the 5d point of view, (3.44) corresponds to the counter term in terms of a superpotential W = g I X I (refer to [56] for example; here we take g = 1), which respects supersymmetry (refer to Appendix C of [57] for example): Consequently, the gravitational partition function can be approximated from (3.47) as in the small Newton's constant limit, which corresponds to the large-N limit under the AdS/CFT dictionary (4.3). In the first equation of (3.48), the sum has to be taken over asymptotically AdS 3 × Σ g solutions whose conformal boundary read T 2 × Σ g in the Euclidean signature, where the complex structure of T 2 is specified by a modular parameter τ .

Comparison of partition functions
In this section, we compare the result from the field theory side in section 2 with the one from the gravity side in section 3.
In the field theory side, the canonical partition function derived from the twisted index of N = 4 SU(N ) SYM theory on T 2 × S 2 by the inverse Laplace transform is given from (2.76) as In the gravity side, the gravitational partition function approximated as a sum over 5d extremal solutions (3.36) in N = 2 gauged STU model is given from (3.48) as for g = 0, where Θ is defined in (3.5). Using the AdS/CFT dictionary and the constraint on magnetic charges 3 a=1 n a = 2 given in (2.3), it is straightforward to check that the exponent in (4.1) matches the exponent in (4.2) in the large-N limit.
However, there is a subtle issue for the precise match between a canonical partition function (4.1) and a gravitational partition function (4.2): the sum of labels (c, d) is taken over (c, d) ∈ N × Z without the relatively prime condition gcd(c, d) = 1 in (4.1), which is different from the sum in (4.2). Due to this difference, some of contributions in (4.1) do not seem to have counterparts in (4. There are two different possibilities for this issue to be resolved. First one is that the contributions labelled by (c, d) ∈ N × Z with gcd(c, d) = 1 cancel each other in (4.1). Recall that we have ignored pure imaginary terms in the exponent of various contributions in (4.1) under the large-N limit, which is hidden in o(N 2 ), since they are defined modulo 2πiZ. But they can still provide non-trivial phases to various contributions labelled by (c, d) ∈ N × Z. Therefore, when there is more than one contributions labelled by the same set of integers (c, d) in (4.1), there is a possibility for them to cancel each other. It is highly non-trivial to prove the statement, however, that such a cancellation happens precisely for (c, d) ∈ N × Z with gcd(c, d) = 1. This is mainly because one cannot rely on the large-N asymptotics to compute the phase of a standard contribution Ω {m,n,r} precisely and, furthermore, nonstandard contributions must be taken into account for a complete proof of the statement. We leave the test of this statement for future research, together with a complete analysis of the remaining non-standard contribution Ω non-st in (4.1).
Another possibility is that the gravitational partition function (4.2) is missing the contributions labelled by (c, d) ∈ N × Z with gcd(c, d) = 1. This possibility is reminiscent of the observation that the complete sum of contributions from the SL(2,Z) family of BTZ black holes [1,34] to the path integral does not yield a physically sensible partition function [58], which has been revisited in the interesting recent work [59] that shows the existence of nontrivial contributions from a class of new topologies without classical solutions. Similarly, the family of 5d extremal solutions (3.36) derived from the SL(2,Z) family of BTZ black holes might not be enough to yield a correct gravitational partition function that matches a dual canonical partition function (4.1) including the contributions labelled by (c, d) ∈ N × Z with gcd(c, d) = 1. This could be another interesting direction to explore in the future.

Discussion
Here we discuss a few remaining questions for future research.

Complete match of partition functions
First of all, it is important to understand that the comparison of a canonical partition function (4.1) and a gravitational partition function (4.2) is not complete yet for the following reasons.
• The comparison is based on the conjecture introduced in 2.3.2 that, if the contribution labelled by (c, d) in (4.1) does not come from a standard BAE solution, there is a nonstandard BAE solution that gives the same contribution. This conjecture has not yet been proven but there is a partial evidence in the literature [29,38].
• The sum over a set of integers (c, d) are different in (4.1) and (4.2). To remedy the difference, one needs to figure out if the contributions labelled by (c, d) ∈ N × Z with gcd(c, d) = 1 in (4.1) cancel each other. If there is a precise cancellation, the match between (4.1) and (4.2) becomes complete upto the remaining non-standard contribution Ω non-st in (4.1). Otherwise holographic duals of the contributions labelled by (c, d) ∈ N × Z with gcd(c, d) = 1 have to be explained, which are currently missing in (4.2).
• The remaining non-standard contribution Ω non-st in (4.1) has not yet been computed.
If it turns out not to vanish, the corresponding holographic dual has to be explained, which is currently missing in (4.2).
To deal with the above questions and thereby make the comparison of a canonical partition function (4.1) and a gravitational partition function (4.2) more solid, systematic understanding of non-standard solutions to the BAE (2.8) is required. We leave this analysis for future research.

Application to generic AdS 5 black strings and refined indices
Next, one may extend what we have discussed so far to more generic AdS 5 black string solutions and dual topologically twisted indices refined accordingly. To be specific, one may add electric charges associated with flavor symmetries [45] and rotations [24,27] to a purely magnetic AdS 5 black string solution of N = 2 gauged STU model studied in this paper, where the latter was done by uplifting a 4d dyonic rotating black holes in [60]. The refined topologically twisted index dual to this generalized AdS 5 black string has also been known [24,27]. It is then natural to expect that the comparison in section 4 can be generalized by matching a canonical partition function derived from the refined twisted index with a gravitational partition function derived from the near-horizon limit of a dyonic rotating AdS 5 black string. We leave this extension for future research. Similarly, one may extend our analysis to recently constructed spindle solutions where the Riemann surface Σ g used in this paper is replaced with a two-dimensional orbifold known as a spindle [61,62]. In this case, however, a dual twisted index has not yet been explored enough and therefore a direct comparison between a canonical partition function and a gravitational partition function could be more demanding.

N = 4 SYM superconformal index and a black hole Farey tail
We would also like to mention that a similar physics can be studied for the superconformal index of N = 4 SU(N ) SYM theory [63,64] and its holography. Note that the N = 4 SYM superconformal index allows for the BA formula [42] with the BAE same as the one for the topologically twisted index (2.8), provided chemical potentials associated with angular momenta are identical (refer to [65] for the BA formula with generic chemical potentials). This means that the N = 4 SYM superconformal index receives contributions from the same family of BAE solutions with the SL(2,Z) modular structure, which we reviewed in subsection 2.1. Hence we expect that the N = 4 SYM superconformal index is closely related to the black hole Farey tail in the gravity side as is the twisted index.
In fact, a relation between the black hole Farey tail and the superconformal index has already been anticipated in [66]. To make such a relation more explicit, following what we have done for the twisted index, one may need to explore a locally AdS 3 geometry in the near-horizon limit of a rotating electrically charged AdS 5 black hole [67] dual to the superconformal index, which has partially been pursued in [68]. The result of this line of research is expected to improve holographic understanding of the superconformal index by relating orbifold solutions constructed in [32], which are holographically dual to partially deconfined phases [38] or equivalently to generalized Cardy-like asymptotics [33], to the black hole Farey tail. Also refer to [69] for a recent comment on a possible relation between the black hole Farey tail and the N = 4 SYM superconformal index for generic chemical potentials with SL(3,Z) modularity.

Euclidean black saddles and the grand-canonical ensemble
Another interesting direction is to explore Euclidean black saddles [44] that include the family of 5d extremal solutions we have constructed in subsection 3.2 as a special case. In [44], the authors constructed a large class of new Euclidean solutions to the BPS equations of 4d N = 2 gauged STU model, dubbed as Euclidean black saddles, and matched their regularized onshell actions with the logarithm of the topologcially twisted index of dual ABJM theory. They are matched as functions of chemical potentials, not charges: in other words, they are matched in grand-canonical ensemble. Based on this observation, we expect that similar Euclidean black saddles exist in 5d N = 2 gauged STU model and provide holographic duals of the N = 4 SYM twisted index in grand-canonical ensemble. This will extend a current holographic understanding of the N = 4 SYM twisted index further, which is investigated only at canonical level in this paper. For example, the properties of the twisted index as a weak Jacobi form [31], including the modular property reviewed in subsection 2.2.2, can be studied holographically in grand-canonical ensemble where chemical potentials ∆ a are not fixed; in this paper, we left τ as a free modular parameter but still fixed chemical potentials ∆ a for a comparison of partition functions.

Generalization of a black hole Farey tail
Lastly, it is important to reproduce the matching between a canonical partition function derived from the twisted index by the inverse Laplace transform, (2.76), and a gravitational partition function for a full AdS 5 black string of the form (3.1), not for its near-horizon geometry (3.36). Even though we have explained in 3.3 why the gravitational partition function for a near-horizon solution (3.48) is enough to reproduce a canonical partition function (2.76), the argument depends on the observation in the field theory side, namely the equivalence between the 2d elliptic genus and the 4d twisted index [31]. Hence, to reproduce the canonical partition function (2.76) purely from the gravitational side without a prior knowledge in a dual field theory, it is worthwhile to derive the final expression (3.48) from the regularized on-shell action of a full black string solution.
For such a direct comparison, first we should figure out how to compute the regularized on-shell action of a full black string of the form (3.1). Then we should construct a family of supersymmetric AdS 5 black strings whose conformal boundary T 2 × S 2 has a complex structure on T 2 specified by a modular parameter τ , following subsection 3.2.1. 8 This step corresponds to generalizing the black hole Farey tail story to the AdS 5 /CFT 4 correspondence; refer to [69] for a relevant discussion in the context of duality between an AdS 5 black hole and the N = 4 superconformal index. Based on the above two achievements, one can compute the gravitational partition function from the regularized on-shell action of a family of supersymmetric AdS 5 black strings, following subsection 3.3. For the reason we have explained above and in subsection 3.3, we expect that the resulting gravitational partition function take the same form of (3.48) and thereby match a dual canonical partition function (2.76). We leave this interesting direction for future research.
Finally we investigate asymptotic behaviors of elliptic functions. To begin with, the Dedekind eta function is given in the limit where |τ | → 0 + with fixed 0 < arg τ < π as log η(τ ) = − πi 12τ

B Upper bound for infinite product terms
In this appendix, we estimate upper bounds for infinite product terms used to evaluate the large-N asymptotics of Z  Here we have assumed generic chemical potentials for n∆ a / ∈ Z. Now it is clear that the infinite product term in (2.34) is bounded as in (2.35).
If ∆ a is real, we have∆ a = 0 and therefore the integer j a defined in (2.33) also vanishes. In this case, one should factor out − log 1 − e 2πim∆a from the LHS of (B.4) to obtain the same upper bound in the RHS. This extra term will not affect the N 2 -leading order in (2.37) though.
Next we apply the base inequality (B.1) to (2.46). Under the identifications  Here we have assumed generic chemical potentials for mp(∆ a −∆ a s) / ∈ Z. Now it is clear that the infinite product term in (2.46) is bounded as in (2.47).

C N = 2 gauged STU model
The N = 2 gauged STU model refers to 5d N = 2 gauged supergravity coupled to two vector multiplets [71,72], which can be obtained from a consistent truncation of 10d Type IIB supergravity on AdS 5 × S 5 [73]. The bosonic action of this STU model is given in the convention of [73,74] as where x ∈ {1, 2} and i, j, k ∈ {1, 2, 3} and the Levi-Civita symbol is given as ε µνρσλ = −|g| −1/2 (even permutation of µνρσλ) +|g| −1/2 (odd permutation of µνρσλ) . (C. 2) The physical scalars φ x are parametrized by X i under the constraint X 1 X 2 X 3 = 1 as From the bosonic action (C.1), the Einstein equations are given as The scalar equations of motion are given as The Bianchi identity and the vector equations of motion are given as The BPS equations are given as one can simplify (C.10) further as