are zero. The discovery of these formulae involves a computer search for such linear combinations after computing the individual sums. The search procedure consists of choosing a range of parameter values for s, b, and m, evaluating the sums out to many digits, and then using an integer relation-finding algorithm (typically Helaman Ferguson's PSLQ algorithm) to find a sequence A that adds up those intermediate sums to a well-known constant or perhaps to zero. The BBP formula for The original BBP summation formula was found in 1995 by Plouffe using PSLQ. It is also representable using the P function above: which also reduces to this equivalent ratio of two polynomials: This formula has been shown through a fairly simple proof to equal . BBP digit-extraction algorithm for We would like to define a formula that returns the nth hexadecimal digit of . A few manipulations are required to implement a spigot algorithm using this formula. We must first rewrite the formula as Now, for a particular value of n and taking the first sum, we split the sum to infinity across the nth term: We now multiply by 16n, so that the hexadecimal point (the divide between fractional and integer parts of the number) is in the nth place: Since we only care about the fractional part of the sum, we look at our two terms and realise that only the first sum is able to produce whole numbers; conversely, the second sum cannot produce whole numbers, since the numerator can never be larger than the denominator for k > n. Therefore, we need a trick to remove the whole numbers for the first sum. That trick is to reduce modulo 8k + 1. Our sum for the first fractional part then becomes Notice how the modulus operator always guarantees that only the fractional sum will be kept. To calculate 16n−k mod (8k + 1) quickly and efficiently, the modular exponentiation algorithm is used. When the running product becomes greater than one, the modulus is taken, just as for the running total in each sum. Now to complete the calculation, this must be applied to each of the four sums in turn. Once this is done, the four summations are put back into the sum to : Since only the fractional part is accurate, extracting the wanted digit requires that one removes the integer part of the final sum and