Research Article - (2026) Volume 5, Issue 4
A Computational Algorithm For The Hardy Function Z(t), Utilizing Sub-Se-quences of Generalized Cubic Gauss Sums, With An Overall Operational Complexity O((t⁄εt)[0.25, 0.3]{log(t)}2+o(1)) FOR ∈[1023−35]
2University of California, Berkeley, USA
Received Date: Jul 17, 2026 / Accepted Date: Aug 10, 2026 / Published Date: Aug 26, 2026
Copyright: ©2026 D. M. Lewis. et al. This is an open-access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Citation: Lewis, D. M., Brereton, A. R. (2026). A Computational Algorithm For The Hardy Function Z(t), Utilizing Sub-Sequences of Generalized Cubic Gauss Sums, With An Overall Operational Complexity O((tÃÂâÃÂÃÂÃÂÃÂÃÂÃÂÃÂõt) [0.25, 0.3]{log(t)}2+o(1)) FOR ÃÂâÃÂÃÂÃÂà[1023ÃÂâÃÂÃÂÃÂÃÂ35]. J Math Techniques Comput Math, 5(4), 1-45
Abstract
In 2011 G. A. Hiary devised a computational algorithm for the Hardy function ð?(ð?¡), requiring just ð??(ð?¡1/3{ð??ð??ð??(ð?¡)}ð??) operations. This compares to ð?? operations necessary for computing ð?(ð?¡) using the classical Riemann-Siegel formula. The methodology involved the sub-division of the Riemann-Siegel formula into sequences of quadratic Gauss/exponential sums of various lengths ð?. Such sums can be computed rapidly, in ð??(ð??ð??ð??(ð?)) operations, using standard recursive schemes. More recently, the principal author developed a similar algorithm with an ð??((ð?¡⁄ ð?¡)1⁄3{ð??ð??ð??(ð?¡)}2) operational count, accurate to ð?¡ in the relative error. Although constructively analogous, the sub-division into quadratic sums was applied to a different asymptotic formula for ð?(ð?¡), giving the new algorithm an original formulation. This paper presents a significant extension of these ideas. The main theoretical result is an asymptotic expression for ð?(ð?¡) in terms of subsequences of generalised, ð??ð?¡â??-order, Gauss sums of progressively increasing length. Computationally, the main focus falls upon the cubic Gauss sum formulation. The particular parameterisation of these cubic sums makes them amenable to rapid computation, utilising a recursive scheme similar to those implemented for quadratic sums. The net result is a computational algorithm for ð?( with a reduced ð??((ð?¡⁄ ð?¡)[0.25, 0.3]{ð??ð??ð??(ð?¡)}2+ð??(1)) operational count for ð?¡ , to high accuracy. Sample computations lend practical support to these findings.
Keywords
The Hardy Function, Generalized Gauss Sums, Riemann Zeta Computations MSC2020 Classification Codes: 11Mxx, 41- 04, 65Exx
Introduction
Interest in novel methodologies for the computation of the Riemann zeta function ζ(S ) along the critical line S = 1 \ 2 + it remains strong, given its fundamental importance to the distribution of the primes. Practically, computations along the critical line come down to the


The algorithms developed by [2,7] rely primarily on the observation (made by D. R. Heath-Brown [see 7] on analysis presented in [24, section 5.2]) that subsections, or ‘blocks’, of terms that constitute the main part of the Riemann-Siegel formula could be re-written in the form of a series of quadratic Gaussian sums, albeit with very specific parameters. The algorithm of rests on an analogous observation but applied to asymptotic approximations for the terms of (4). A general quadratic Gaussian sum of length N is defined by

Formulating Hardys z-Function into Generalized mth-order Gauss Sums



Combining Together Collections of Integrals That Form the Main Sum (9) for z(t)


Extended analysis of integral Bc(aE¸t j)









The polynomial expressions W±(µ∗).




z(t) composed in terms of Generalized mth-order Gauss Sums





Efficient computation of the particular Generalized Gauss Sums constituting z(t)


Derivation of the reciprocity formula for generalized mth-order Gauss sums



Estimation of Term (67a)






Estimation of Terms (67b) and (67c)






Analysis of the secondary sum in (96)







A recursive scheme for the efficient computation of a Generalized mth-order Gaussian sumSN (Φ ), satisfying coefficient conditions (63).



An algorithm for the recursive computation of a Generalized mth-order Gauss Sum SN(Φ1,m ), with N« 1, m≥3 and coefficients Φ1..m satisfying the specific conditions set out in equation (63). (algorithm MGS)


Sample computations using algorithm MGS
Cubic Gauss sums (m= 3)





Quartic Gauss Sums (m = 4): the reductive bound on cut-off k.



Error Analysis


Since these get more complicated with the order of the sum, the €1...LK−1|} is usually associated with the error in the first iteration €1...LK−1 beyond the kernel sum. In the tables one can see the relative error jumping up in the first couple of iterations, before stabilising thereafter. In the quadratic case discussed in [14] it was possible to put a specific bound on this term. For the higher order sums discussed here it much more difficult to formulate such a bound. Rather than pursue this, one can take the pragmatic view that more precise estimates can be simply computed by including more terms in the approximations developed in section 3.1.1. As ever, greater precision imposes a higher operational count, and one must balance the demands for high computational speed against high accuracy.
In conclusion, the results presented in this section demonstrate that the specific type of Generalized Gaussian sums which constitute the Hardy function in (62) can be computed very efficiently by means of algorithm MGS. Large scale calculations of the Hardy function itself, utilising this methodology, are presented in the next section.
Sample Computations of z(t) for large t utilising Cubic Gauss Sums

Formulation of a hybrid summation formula for the estimation of z(t)



Computational scheme for the hybrid summation formula







Sample Computations
Thanks to the invaluable web-based database [9] of sample calculations of the Hardy function, it is possible to compare the performance



Table 5 shows a similar comparison of the accuracy of the new hybrid scheme for a selection of t values where z(t) exhibits an unusually large local maximum/minimum, compared to other such points in its vicinity. (Since z(t) is unbounded, much greater values of |z(t)| certainly exist, although for larger, computationally unfeasible t values.) Details of the methodology utilised to identify narrow intervals along the critical line where such points are likely (but not guaranteed) to occur, are discussed in [9]. The latter reference also provides details of many examples where |z(t)|>103, whilst [23] highlights some calculations of especially large values of |z(t)|>104, utilising the z(t(1)) algorithm. The large |z(t)| computations shown in Table 5 are for t> 1028, covering the highest possible range of computationally feasible t values.
For these particular computations, a parallelised version of the hybrid summation code was developed for implementation on the ARCHER2 UK National Supercomputing Service (http://www.archer2.ac.uk) hosted by the University of Edinburgh. Open-source variants of this hybrid code are now freely available from the repository [15], along with documentation describing its implementation and some sample output files. ARCHER2 is a HPE Cray EX supercomputing system with a total of 5860 nodes, each consisting of two 2.25GHz, 64 core AMD EPYC7742 processors with access to 256GB of memory (https://www.archer2.ac.uk/user-guide/hardware/). Most of the computations listed in Table 5 were run using 4-8 nodes and required between 3-12 hours of CPU time. However, the highest calculations, when t ≥ 1032, were carried out during one of the periodic ARCHER2 Capability Days sessions, which give users the opportunity to run large scale jobs, at no budgetary cost, using many nodes. The t ≥ 1032 calculations highlighted in the Table 5 employed 512-1024 nodes and typically required between 1-3 hours of CPU time.
Looking at the results shown in Table 5, one can see the agreement between the hybrid estimates and the corresponding values published in [9, 23] is excellent, with all the relative errors lying far below the prescribed value of €t = 0.005. The absolute errors are also very low, which is noteworthy since such errors tend to reach a maximum in and around points where |z(t)| is large. Of course, if more accurate estimates are desired, then one can simply reduce the user prescribed value of €t , at the expense of a marginal increase in run times. One of the chief difficulties encountered for computations where t > 1028 is the potential for catastrophic round-off error, resulting from the fact that Fortran double precision variables can only represent numbers to an accuracy of some thirty-three significant figures. In order to circumvent this issue, the main Fortran codes in the repository [15] utilise certain C subroutines from the PariGP computer library [20], accurate to many thousands of digits, for those particular calculations where round-off error is problematic. Indeed, it is anticipated that the repository code should be capable of carrying out computations for t~1040 or even a little beyond, before the need for quadruple precision reals becomes imperative. However, although feasible, calculations on this scale would exhaust the supercomputer budgetary resource allocation very generously awarded in support of this work.
|
ðÂÂ?¡ value |
ðÂÂ?ÂÂ(ðÂÂ?¡) Hybrid algorithm of sections 4.1-2. |
ðÂÂ?ÂÂ(ðÂÂ?¡) ðÂÂ?¡1⁄3 algorithm of [2, 7]; ±5 × 10−7 |
Relative error |ðÂÂ??ðÂÂ??| |
|
2.059936512320112518074691006892E28 |
3803.86727 |
3803.86539 |
4.30 × 10−7 |
|
3.177469531676391818363765436511E28 |
−9549.91673 |
−9549.88868 |
2.93 × 10−6 |
|
4.670914185466097236850548903274E28 |
9587.87895 |
9587.85455 |
2.54 × 10−6 |
|
1.0835660710102772561572011153186E29 |
7297.78564 |
7297.75658 |
3.98 × 10−6 |
|
2.8928607671932530771838054905026E29 |
10907.57778 |
10907.55189 |
2.37 × 10−6 |
|
5.5216641000993128888680863234651E29 |
−13541.70579 |
−13541.67744 |
2.09 × 10−6 |
|
6.9815628897151991613594294046033E29 |
11187.59076 |
11187.56821 |
2.02 × 10−6 |
|
8.0362572859234436312381421877820E29 |
10282.41019 |
10282.40085 |
9.13 × 10−7 |
|
1.42060805696869950116950900347991E30 |
5045.59913 |
5045.59024 |
1.76 × 10−6 |
|
1.90791528718078622313186060719755E30 |
10242.78033 |
10242.78831 |
7.78 × 10−7 |
|
2.40997280874481941027683455628022E30 |
−9268.18171 |
−9268.20237 |
2.23 × 10−6 |
|
3.96223170348329766133173296323307E30 |
−7483.25069 |
−7483.25629 |
7.49× 10−7 |
|
6.08302869527654580706324834685591E30 |
9729.73977 |
9729.76572 |
2.66 × 10−6 |
|
6.22949918584108157280509258048941E30 |
−14335.913 |
−14335.948 |
2.39 × 10−6 |
|
6.63237818782358897400245791070660E30 |
12010.61542 |
12010.63042 |
1.24 × 10−6 |
|
6.82518053590400464945958005027695E30 |
12561.854 |
12561.880 |
2.02 × 10−6 |
|
9.66225949824542125462912689965804E30 |
−12070.174 |
−12070.186 |
1.07 × 10−6 |
|
9.83228440804649950062286954013174E30 |
−10123.63767 |
−10123.62451 |
1.30 × 10−6 |
|
1.472969364244678383540127734056387E31 |
−7707.03675 |
−7706.96360 |
9.49 × 10−6 |
|
1.970307186839852852378315796522770E31 |
−13870.960 |
−13870.969 |
6.84 × 10−7 |
|
2.845670144939668837484722465519674E31 |
−15484.372 |
−15484.420 |
3.12 × 10−6 |
|
3.557586000421470624922724880597724E31 |
13337.02398 |
13337.12691 |
7.71 × 10−6 |
|
3.924676458989430915525116928410405E31 |
16244.39356 |
16244.47429 |
4.96 × 10−6 |
|
4.589001484792927188496155886462819E31 |
9967.75442 |
9967.80244 |
4.80 × 10−6 |
|
5.005475723107396211588045467161740E31 |
−10621.48019 |
−10621.51326 |
3.12 × 10−6 |
|
6.080550187116167583688613601408264E31 |
14110.817 |
14110.835 |
1.28 × 10−6 |
|
7.039106631049132430879196955445325E31 |
−14055.05211 |
−14055.11312 |
4.33 × 10−6 |
|
9.066617388021913893282064021886284E31 |
15601.555 |
15601.620 |
4.16 × 10−6 |
|
1.2783429043337574414365607070650632E32 |
−15566.535 |
−15566.607 |
4.64 × 10−6 |
|
2.8609411594551963691214046991910957E32 |
16093.291 |
16093.351 |
3.73 × 10−6 |
|
2.9615715957422120018598884000190662E32 |
−16477.936 |
−16478.028 |
5.61 × 10−6 |
|
3.1067883362908396566754057659368205E32 |
16874.148 |
16874.202 |
3.20 × 10−6 |
|
4.2114691908666607058133050702649423E32 |
−15207.804 |
−15207.882 |
5.14 × 10−6 |
|
6.9619002836022067265947731886112914E32 |
11358.636 |
|
|
|
7.1071732114916294610536133167221954E32 |
−8632.336 |
|
|
|
9.1724411211204221645707071038294101E32 |
−11557.987 |
|
|
|
1.04460781211065043835431081519805492E33 |
11303.206 |
|
|
|
1.06269161656636941548485858301763355E33 |
−7331.794 |
|
|
|
1.42368234667160116783366845609851195E33 |
11563.860 |
|
|
|
2.13961597512187919855165627131694812E33 |
−6474.999 |
|
|
|
5.08596628180943122832041195042272642E33 |
4904.773 |
|
|
Table 5: Illustrative calculations of the Hardy function for t > 1028 utilising the hybrid formulation methodology, compared to the corresponding values listed in [9, 23]. At these particular t values the modulus of z(t) is unusually large. For all the hybrid computations, the precision setting was∈t = 0.005 with k ∈ [598, 992].
Conclusions

Acknowledgments
The authors would like to acknowledge the help and advice of the ARCHER2 UK National Supercomputing Service User Support Team in facilitating the computational results presented in this paper. In particular, the help of Dr Mario Antonioletti (EPCC, The University of Edinburgh) is acknowledged. Establishment of the GitHub computational repository [15] was funded under the EPSRC/ARCHER2-eCSE grant scheme (grant no. 11-7).
References
- Berndt, B. C. & Evans, R. J. 1981 The Determination of Gauss Sums. Bull. Amer. Math. Soc. 5(5), 107-129.
- Bober, J. W. & Hiary. G. A. 2018 New computations of the Riemann zeta function on the critical line. Experimental Mathematics 27(2), 125-127.
- Borwein, J. M., Bradley, D. M. & Crandell, R. E. 2000 Computational strategies for the Riemann zeta function. J. Comp. Appl.Math. 121, 247-296.
- Edwards, H. M. 1974 Riemann’s zeta function, New York, Dover Publications.
- Gabcke, W. 1979 Neue Herleitung und Explizite Restabschätzung der Riemann-Siegel-Formel. Ph.D. thesis, Göttingen.
- Gradshteyn, I. S. & Ryzhik, I. M. 2007 Table of Integrals, Series and Products. (7th edition) Jeffrey, A. & Zwillinger, D. (eds.) Elsevier Academic Press.
- Hiary G. A. 2011 Fast methods to compute the Riemann zeta function. Annals of Mathematics 174, 891-946.
- Hiary G. A. 2011 A nearly-optimal method to compute the truncated theta function, its derivatives and integrals. Annals of Mathematics 174, 859-889.
- Hiary G. A. 2017 Fast methods to compute the Riemann zeta function.
- Huxley M. N. 2005 Exponential sums and the Riemann zeta function V. Proc. Lond. Math. Soc. 90, 1-41.
- Iviac A. 2003 The Riemann Zeta-Function. Dover Publications, Inc., New York (republication of work published in 1985 by John Wiley & Sons, New York).
- Iviac A. 2013 The Theory of Hardy’s Z-Function. Cambridge Tracts in Mathematics, Cambridge University Press.
- Lewis, D. M. 2015 The development of a hybrid asymptotic expansion for the Hardy function z(t), consisting
main terms, some 17% less than the celebrated Riemann-Siegel formula. - Lewis, D. M. 2017 A computational algorithm for the Hardy function z(t)utilising sub-sequences of generalised quadratic Gauss sums, with an overall complexity operational complexity 0(t\t),1\3 {log(t)2+0(1))
- Lewis, D. M. 2025 Hardy Code-Detailed Documentation, GitHub repository.
- Luke, Y. L. 1969 The special functions and their approximations (Vol. 1), New York & London, Academic Press.
- Montgomery, H. L. & Vaughan R. C. 2006 Multiplicative Number Theory: I. Classical Theory. (Ch.9) Primitive characters and Gauss sums pp 282-325, Cambridge Studies of Advanced Mathematics 97, Cambridge University Press.
- Odlyzko, A. M. & Schönhage A. 1988 Fast algorithms for multiple evaluations of the Riemann zeta function. Trans. Amer. Math. Soc. 309, 797-809.
- Olver, F. W. J., Lozier, D. W., Boisvert, R. F. & Clark, C. W. 2010 NIST Handbook of Mathematical Functions, Cambridge University Press.
- Pari/GP computer algebra library 2003-2026 (Originally developed by Cohen, H. et. al. at the University of Bordeaux).
- Paris, R. B. 2008 An Asymptotic Expansion for the Generalised Quadratic Gauss Sum. Applied Mathematical Sciences 2(12), 577-592.
- Siegel, C. L. 1960 Uber das quadratische Reziprozitätsgesetz Zahlkörpern Nachr. Akad. Wiss. Göttingen Math.-Phys. Kl. No. 1, 1-16.
- Tihanyi, N. 2019 Numerical computing of extremely large values of the Riemann-Siegel Z-function. PhD thesis, Doctoral School of Informatics, Numeric and Symbolic Computations, Eötvös Lorand and University.
- Titchmarsh, E. C. 1986 The theory of the Riemann zeta-function, 2nd edn. Oxford, Clarendon Press.

Figures 2a and 2b: Contour integration paths utilised to estimate integrals given by equations (71: Fig. 2a) and (82: Fig. 2b). In each case the path of integration along the real line (solid arrow) is substituted by the complex contour path traced out by the dashed arrows. Estimates for the constituent line segments forming the respective contour paths are derived in the text.


