Mark Gritter (markgritter) wrote,
Mark Gritter

Using CRT to calculate Bernoulli Numbers

I happened across "A multimodular algorithm for computing Bernoulli numbers" which implements a cute hack. The Bernoulli number B(k) mod p can be efficiently calculated for prime p > 5. You can calculate a bunch of B(k) mod p_i in parallel, then use the Chinese Remainder Theorem to stitch those results back into the desired number. This algorithm's now part of the Sage toolkit.

Calculating B(20000000) took 79 days in 2012, using this implementation.

I wonder what other functions could be decomposed this way? Once you start paying attention to bits (and not just words), operating "mod p" can save you a lot of time spent multiplying, both theoretically and practically.
Tags: combinatorics, mathematics
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.