Riemann Zeta Function in a Calculator

One function, one line and a million-dollar question. The Riemann zeta function links ordinary numbers with prime numbers, and its zeros are the subject of one of the most famous questions in mathematics. In REMcalc 1.1 you can compute it, plot it and find the zeros yourself – and see that all the ones you find lie on a single line.

Video: the point zeta(1/2 + it) draws a spiral that passes through the origin ten times
Video: the spiral ζ(½ + it) 0:17 – the point ζ(½ + it) for t from 0 to 50. Every time the spiral passes through the origin, that is a non-trivial zero of the zeta function. The task finds ten of them and computes their positions to three decimal places.

What the zeta function is

For a number s with a real part greater than 1, the zeta function is the sum of an infinite series

ζ(s) = 1 + 1/2s + 1/3s + 1/4s + …

For s = 2 you get Leonhard Euler's famous result ζ(2) = π²/6 = 1.6449… Euler also discovered that the same function can be written as a product over all prime numbers:

ζ(s) = 1/(1 − 2−s) · 1/(1 − 3−s) · 1/(1 − 5−s) · 1/(1 − 7−s) · …

Why this holds: each factor 1/(1 − p−s) is a geometric series 1 + p−s + p−2s + …, and when you multiply them out, every number n appears exactly once – because every number can be broken down into primes in only one way. This is where the link between the zeta function and prime numbers begins.

In 1859 Bernhard Riemann showed that the zeta function can be extended to the whole complex plane except the point s = 1, where it has a pole. The extended function has two kinds of zeros:

This is the Riemann hypothesis. It is one of the seven Millennium Prize Problems of the Clay Mathematics Institute, with a prize of one million dollars. Computers have verified it for more than ten trillion of the first zeros. And how regularly the prime numbers are spread among the other numbers depends on where the zeros lie.

News from November 2026: on 20 November 2026 the mathematician Levent Alpöge announced a proof of the Riemann hypothesis, created with the help of artificial intelligence as a formal proof in the Lean system (over 17 million lines). The Lean FRO team and the Mathlib community have said they are convinced it is correct. So a computer has checked every step, but a human-readable proof has not been published yet, and recognition will be decided by expert review and the Clay Institute – the announcement is not yet an accepted proof. More in the essay R for Reality, Riemann and Reload. Sources: Associated Press, The Conversation (Phys.org), Clay Mathematics Institute.

A spiral on the critical line

If you substitute s = ½ + it and let t grow, the value ζ(½ + it) travels around the complex plane in loops. A non-trivial zero is exactly where a loop passes through the origin – that is what the video above shows.

A zero cannot be pinpointed exactly from the picture of the spiral, so the task gets help from the Riemann–Siegel function Z(t). It rotates zeta on the critical line by the angle θ(t) so that the result is real:

Z(t) = eiθ(t) · ζ(½ + it),    θ(t) ≈ t/2 · ln(t/2π) − t/2 − π/8 + 1/(48t) + 7/(5760t³)

A real function changes sign at a zero. So the task watches for the sign of Z to flip between two steps and refines the position of the zero by linear interpolation. The results are 14.135, 21.022, 25.011, 30.425, 32.935, 37.586, 40.919, 43.327, 48.005 and 49.774 – to three decimal places the same as in Andrew Odlyzko's tables of zeros.

How REMcalc computes it

The series 1 + 1/2s + … does not converge for Re s ≤ 1, so on the critical line it cannot be summed directly. REMcalc therefore uses Borwein's formula (P. Borwein, 1991): zeta is expressed through an alternating series with precomputed coefficients ak

ζ(s) = −(a1·1−s + a2·2−s + … + a60·60−s) / (1 − 21−s)

Sixty terms are enough for an accuracy better than 10−12 up to a height of about 50 in Im s. And this is where the new features of version 1.1 help: the coefficients are computed once into the array ak(60), and zeta is an ordinary function zeta(s) that the task calls directly in the expression z = zeta(0.5 + j*t). The function's helper variables are declared local, so they overwrite nothing in the main program.

The program of the zeta task next to the resulting spiral
Program and result. The array ak(60), the function zeta(s) with local variables, a ball with a trail and the list of zeros. The full program is below.

Zeta in the complex plane

A function of a complex variable can be drawn by colouring the plane: the hue shows the argument of ζ(s), the light and dark bands show its magnitude. At a zero all the colours meet, and at a pole too, only in the opposite order.

The coloured complex plane of the zeta function with zeros on the critical line
Coloured plane. Horizontally Im s runs from −2 to 42, vertically Re s from −5 to 3. The non-trivial zeros lie on the white critical line; on the left are the pole at s = 1 and the trivial zeros at −2 and −4. The task Riemannova zeta funkce v komplexní rovině (Riemann zeta function in the complex plane) from the Mathematics Demos library, computed on a finer grid.

The Mathematics Demos library. In REMcalc 1.1 the category Riemannova zeta funkce (Riemann zeta function) contains four tasks – open the Window → Expression Library menu and choose the Mathematics Demos library:

  • Riemannova zeta funkce v komplexní rovině (Riemann zeta function in the complex plane) – the coloured plane from the picture above; use the mouse wheel in the detail graph to zoom in on the neighbourhood of a single zero,
  • Nuly zeta funkce na kritické přímce (Zeros of the zeta function on the critical line) – the function Z(t) in a graph and zeros found by bisection, compared with Odlyzko's table,
  • Eulerův součin a Dirichletova řada (Euler product and Dirichlet series) – how partial sums and products over primes approach ζ(s), and why they do not converge for Re s ≤ 1,
  • Prvočísla a logaritmický integrál (Primes and the logarithmic integral) – the number of primes π(x) against li(x), and a bound that holds exactly when the Riemann hypothesis holds.

Try it yourself

  1. Install REMcalc 1.1 (Download; the Free edition is enough).
  2. In the Window → Expression Library menu, choose the My Formulas library and click New… with the BASIC task box checked.
  3. Paste the program below and run the task. The spiral is drawn across the whole screen; Esc stops it at any time.

Try changing the end of the loop (for kt=0 to 2000) or the step 0.025. It is also interesting to draw the spiral off the critical line – in the line z = zeta(0.5 + j*t), write 0.6 instead of 0.5. The spiral then misses the origin; the list of zeros no longer applies, because the function Z(t) is real only on the critical line.

Comments and variable names in the program are in Czech.

' Riemannova zeta na kritické přímce: bod zeta(1/2 + it) pro t od 0 do 50
' kreslí spirálu; kdykoli projde počátkem, je to netriviální nula
mode rad, cplx, imag=j
scene -3.2, 5.6, -2.85, 2.65
' Borweinovy koeficienty do pole ak (60 členů)
dim dd(61), ak(60)
nb = 60
tr = 1/nb
sm = tr
dd(1) = nb*sm
for i0=1 to nb
  tr = tr*4*(nb+i0-1)*(nb-i0+1)/((2*i0)*(2*i0-1))
  sm = sm + tr
  dd(i0+1) = nb*sm
next
for k=1 to nb
  ak(k) = (-1)^(k-1)*(dd(k)-dd(nb+1))/dd(nb+1)
next
def zeta(s)
  local k, sz
  sz = 0
  for k=1 to 60
    sz = sz + ak(k)*k^(-s)
  next
  zeta = -sz/(1 - 2^(1-s))
enddef
' osy a popisky
line 101, -1.75, 0, 5.4, 0, gray, 1.5
line 102, 0, -2.6, 0, 2.5, gray, 1.5
text 103, 5.0, -0.06, "Re", 16, gray
text 104, 0.08, 2.55, "Im", 16, gray
text 105, -3.1, 2.6, "Riemannova zeta funkce ζ(1/2 + it)", 24, white
shape 1, ball, -1.46, 0, 16, yellow
trail 1, 2000
shape 2, ring, 0, 0, 34, red
hide 2
nul = 0
zp = 0
for kt=0 to 2000
  t = kt*0.025
  z = zeta(0.5 + j*t)
  move 1, re(z), im(z)
  text 106, -3.1, 2.25, "t = %5.2f", 20, yellow; t
  ' nula: Riemannova–Siegelova funkce Z(t) mění znaménko (theta podle Stirlingovy řady, od t = 3)
  if t >= 3 then
    th = t/2*ln(t/(2*pi)) - t/2 - pi/8 + 1/(48*t) + 7/(5760*t^3)
    zt = re(e^(j*th)*z)
    if zt*zp < 0 then
      ' poloha nuly mezi dvěma kroky lineární interpolací
      nul = nul + 1
      t0 = t - 0.025*zt/(zt - zp)
      show 2
      text 200 + nul, -3.1, 1.95 - 0.27*nul, "nula %g: t = %.3f", 18, red; nul, t0
    endif
    if zt*zp >= 0 and kt mod 12 = 0 then hide 2
    zp = zt
  endif
  delay 6
next
hide 2
text 199, -3.1, 1.95 - 0.27*(nul + 1.2), "všechny na Re s = 1/2", 18, white
delay 2500

Sources: B. Riemann (1859), Über die Anzahl der Primzahlen unter einer gegebenen Grösse; P. Borwein (1991), An efficient algorithm for the Riemann zeta function; A. Odlyzko, tables of zeros of the zeta function. The numbers and pictures on this page were computed by REMcalc 1.1.