7.7

## pidec

(require pidec) | package: pidec |

Pidec implements an algorithm to compute single decimals of the sequence of π digits, using only a small amount of memory.

### 1` `References

This work is based on Fabrice Bellard’s paper and his published code can be found here.

The implementation is in the module ‘main.rkt‘, while its tests are defined in ‘test-main.rkt‘. The first one is written in Typed Racket, while the second one is plain Racket. Apparently, Typed Racket does not support defining tests in submodules of the same file as the implementation.

### 2` `Usage

(require pidec/main) | package: pidec |

The main exported function is called main and it accepts a single argument, position, which is the starting position of the π decimals you want to compute.

Returns decimals of π at position. Please note that the resulting integer should be padded on the left with a zero if it has less than 9 positions, e.g. for (main 50) the procedure answers with 58209749, while the true answer is 058209749.