# pidigits description

## Background

MathWorld: Pi Digits.

## Variance

Some language implementations have arbitrary precision arithmetic built-in; some provide an arbitrary precision arithmetic library; some use a third-party library (GMP); some provide built-in arbitrary precision arithmetic by wrapping a third-party library.

## The work

The work is to use aribitrary precision arithmetic and the same step-by-step algorithm to generate digits of Pi. Do both extract(3) and extract(4). Don't optimize away the work.

## How to implement

We ask that contributed programs not only give the correct result, but also **use the same algorithm** to calculate that result.

Each program should:

calculate the first N digits of Pi

print the digits 10-to-a-line, with the running total of digits calculated

**diff** program output N = 30 with this output file to check your program output has the correct format, before you contribute your program.

Use a larger command line argument (10000) to check program performance.

Adapt the **step-by-step** algorithm given on pages 4,6 & 7 of [pdf 156KB] Unbounded Spigot Algorithms for the Digits of Pi. (**Not** the deliberately obscure version given on page 2. **Not** the Rabinowitz-Wagon algorithm.)