Coder Social home page Coder Social logo

lucasaugustus / mertens Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 43 KB

A Python implementation of the Helfgott-Thompson algorithm for computing the Mertens function.

Home Page: https://arxiv.org/abs/2101.08773

Python 100.00%
math mathematics mobius number-theory thompson helfgott helfgott-thompson mertens mertens-function mobius-function

mertens's Introduction

This is a Python implementation of the Helfgott-Thompson algorithm for computing the Mertens function.

Their original C++ code is available at https://arxiv.org/abs/2101.08773. The process of converting it to this code was roughly the following:

  1. Combine the four C++ files into a single file.
  2. Remove the pragmas that made it parallel.
  3. Translate it line-by-line directly into Python3. There are some hiccups here related to pointer arithmetic, negative arguments in the division and remainder operations, and bit-twiddling on fixed-length vs arbitrary-length integers.
  4. In some cases where a function is invoked only once, inline that function.
  5. Make some further changes so that it plays more nicely with the interpreter, such as splitting the compound data types into multiple non-compound types.

Most original comments were copied mostly verbatim, and a few of my own were added.

At some future point, I will attempt to put the parallelism back in, but for now, this is a single-threaded program.

No attempt has been made to tune the tunable parameters.

mertens's People

Contributors

lucasaugustus avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.