Skip to main content
QUICK REVIEW

[Paper Review] Computing the Mertens function on a GPU

Eugene Kuznetsov|arXiv (Cornell University)|Jul 31, 2011
Neural Networks and ApplicationsComputer Science2 references7 citations
TL;DR

This paper presents a GPU-accelerated algorithm to compute the Mertens function $ M(x) $ in $ O(x^{2/3+ heta}) $ time, leveraging recursive summation identities and parallel array updates. It reports a new extreme value $ M(x)/x^{1/2} = -0.585768 $ at $ x \approx 1.161 \times 10^{19} $, and extends searches up to $ \exp(10^{15}) $, finding no counterexamples to the Mertens conjecture.

ABSTRACT

A GPU implementation of an algorithm to compute the Mertens function in O(x2/3+{\ko}) time is discussed. Results for x up to $10^{22}$, and a new extreme value for $M(x)/x^{1/2}$, -0.585768 ($M(x) \approx -1.996 \ast 10^9$ at $x \approx 1.161 \ast 10^{19}$), are reported.An approximate algorithm is used to examine values of M(x) for x up to $\exp{(10^{15})}$.

Motivation & Objective

  • To accelerate the computation of the Mertens function $ M(x) = \sum_{n=1}^x \mu(n) $, where $ \mu(n) $ is the Möbius function, using GPU parallelism.
  • To extend the range of $ x $ for which $ M(x) $ is computed beyond previous limits, particularly to test the Mertens conjecture.
  • To develop a scalable algorithm that computes $ M(x) $ for multiple values simultaneously by exploiting recursive structure in the summation identity.
  • To address numerical precision issues in high-precision trigonometric evaluations required for approximate analysis of $ M(x) $ at $ x \gg \exp(10^{10}) $.

Proposed method

  • Uses the identity $ M(n) = 1 - \sum_{x=2}^n M(\lfloor n/x \rfloor) $, which allows grouping terms by the value of $ \lfloor n/x \rfloor $, reducing the number of distinct terms to $ O(\sqrt{n}) $.
  • Employs a two-phase approach: (1) compute $ M(y) $ for $ y \leq u $ via CPU-based sieving, and (2) use GPU-parallel updates to compute $ M(\lfloor n/x \rfloor) $ for $ x > 1 $, where $ u = O(n^{2/3+\theta}) $.
  • Applies a logarithmic approximation to store partial prime products in 8-bit integers, reducing memory bandwidth and improving cache efficiency during sieving.
  • Uses bit manipulation to flag squareful numbers (via MSB set) and computes $ \mu(y) $ from the sign and magnitude of the accumulated log-prime product.
  • Implements block-wise processing for large $ n $, with high-precision constant tables updated per block to maintain accuracy in cosine evaluations for large $ x $.
  • Uses a shifted reference table of $ b_i' = (b_i + z_i x_0) \mod 2\pi $ for each block to preserve precision in trigonometric terms used in approximate analysis.

Experimental results

Research questions

  • RQ1Can the Mertens function be computed efficiently at scale using GPU parallelism?
  • RQ2What is the largest known value of $ |M(x)/x^{1/2}| $, and does it exceed the bound proposed by the Mertens conjecture?
  • RQ3Can the algorithm scale to $ x \approx \exp(10^{15}) $ while maintaining numerical accuracy?
  • RQ4Are there any counterexamples to the Mertens conjecture $ |M(n)| < n^{1/2} $ within the computed range?

Key findings

  • The algorithm achieves $ O(x^{2/3+\theta}) $ time complexity and successfully computes $ M(x) $ for $ x $ up to $ 10^{22} $.
  • A new extreme value of $ M(x)/x^{1/2} = -0.585768 $ is found at $ x \approx 1.161 \times 10^{19} $, with $ M(x) \approx -1.996 \times 10^9 $.
  • No counterexamples to the Mertens conjecture were found in the range up to $ \exp(10^{15}) $, extending previous searches by two orders of magnitude.
  • The largest observed value of $ |q_{10^6}(x)| $, a proxy for $ M(x)/x^{1/2} $, was $ 0.95652 $ at $ x \approx \exp(5.0586 \times 10^{14}) $.
  • The distribution of extreme values of $ q_{10^6}(x) $ is symmetric, with no evidence of sign asymmetry in large positive or negative values.
  • High-precision block-wise constant updates enabled accurate cosine evaluations up to $ \exp(10^{15}) $, mitigating GPU floating-point precision loss.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.