A faster algorithm for extracting hexadecimal digits of π
This report presents a new algorithm for extracting hexadecimal digits of π without computing preceding digits, surpassing previous methods like Bailey–Borwein–Plouffe (BBP), Bellard, and Huvent in terms of operation count. The key is a relationship among the four powers of two in the identity, allowing us to add four remainders and divide once.
The gaps between remainders remain small multiples of k plus constants, enabling us to reach other remainders by multiplication from a single starting power and step of 2kmod M. By working modulo 3M, the same two exponentiations serve both M and 3M, saving about a million full exponentiations for every million hexadecimal places skipped compared to Huvent's method.
The algorithm leverages the BBP trick, shifting π left by d bits and taking the fractional part to skip n hex digits. It focuses on optimizing existing series, particularly Euler's series from 1779, by aligning denominators instead of powers. By dividing each odd denominator into two progressions, each odd denominator appears twice in each sum, allowing for efficient addition and division.
The formula is derived using Gaussian integers and complex arguments, ultimately expressing π as 8I2 + 4I3, where I2 and I3 are derived from arctangent identities. The algorithm minimizes computational overhead by only computing a few exponents actively, with most other computations involving simple multiplications. By utilizing properties of remainders and modulus, the method achieves significant computational savings over previous approaches.
Rewritten by urgent.news; may contain errors — check the original.
Source: stylewarning.com