9
\$\begingroup\$

Introduction

According to the Riemann Hypothesis, all zeroes of the Riemann zeta function are either negative even integers (called trivial zeroes) or complex numbers of the form 1/2 ± i*t for some real t value (called non-trivial zeroes). For this challenge, we will be considering only the non-trivial zeroes whose imaginary part is positive, and we will be assuming the Riemann Hypothesis is true. These non-trivial zeroes can be ordered by the magnitude of their imaginary parts. The first few are approximately 0.5 + 14.1347251i, 0.5 + 21.0220396i, 0.5 + 25.0108576i, 0.5 + 30.4248761i, 0.5 + 32.9350616i.

The Challenge

Given an integer N, output the imaginary part of the Nth non-trivial zero of the Riemann zeta function, rounded to the nearest integer (rounded half-up, so 13.5 would round to 14).

Rules

  • The input and output will be within the representable range of integers for your language.
  • As previously stated, for the purposes of this challenge, the Riemann Hypothesis is assumed to be true.
  • You may choose whether the input is zero-indexed or one-indexed.

Test Cases

The following test cases are one-indexed.

1       14
2       21
3       25
4       30
5       33
6       38
7       41
8       43
9       48
10      50
50      143
100     237

OEIS Entry

This is OEIS sequence A002410.

\$\endgroup\$
5
\$\begingroup\$

Mathematica, 23 bytes

⌊Im@ZetaZero@#+.5⌋&

Unfortunately, Round rounds .5 to the nearest even number, so we have to implement rounding by adding .5 and flooring.

\$\endgroup\$
1
\$\begingroup\$

PARI/GP, 25 bytes

There's not much support in GP for analytic number theory (it's mostly algebraic), but just enough for this challenge.

n->lfunzeros(1,15*n)[n]\/1
\$\endgroup\$
1
\$\begingroup\$

Sage, 34 bytes

lambda n:round(lcalc.zeros(n)[-1])

Try it online

This solution is a golfed form of the program found on the OEIS page.

lcalc.zeros is a function (which is thankfully spelled the shorter way, rather than zeroes for an extra byte) that returns the imaginary parts of the first n non-trivial Riemann zeta zeros. Taking the -1st index returns the nth zero (1-indexed), and round rounds it to the nearest integer. In Python 3, round uses banker's rounding (half-to-nearest-even), but thankfully Sage runs on Python 2, where round uses half-up rounding.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.