Go to content
Computing the digits of \pi
This method, which uses highly sophisticated iterative techniques and programming, is provided as an illustration of what can be achieved. It is not part of your Advanced Level course!
This program demonstrates arbitrary-precision arithmetic by computing the digits of pi using the Borwein iteration algorithm first published by Jonathan Borwein and Peter Borwein in 1985.
Iteration #1 produces 8 correct decimal digits, iteration #2 produces 41 digits, iteration #3 produces 171 digits, iteration #4 produces 694 digits, and each subsequent iteration increases the number of correct digits by more than a factor of four. Because it needs to test for convergence, the program will do one more iteration than necessary.
This program computes the digits of pi in several phases, and each phase can consist of several tasks. It displays the current phase and task, the elapsed time of the previous phase, and the total elapsed time. (The total elapsed time does not include the time to display the digits of pi).

To ensure the accuracy of the last digits, the program computes with a scale equal to 0.5% more than the specified number of decimal digits. To run the demo:
  1. Enter the number of decimal digits of pi to compute.
  2. Press the Run button.
  3. Press the Stop button at any time to stop the computation.

Software/Applets used on this page

This applet forms part of "Java Number Cruncher: The Java Programmer's Guide to Numerical Computation", Prentice-Hall, by Ronald Mak, and is provided for MathsNetAlevel-plus by that author - see



A set of precise instructions which, if followed, will solve a problem.


successive repetition of a process using the result of one stage as the input for the next.


the ratio of the circumference of a circle to its diameter. It is approximately 3.14159265...

Full Glossary List

This question appears in the following syllabi:

SyllabusModuleSectionTopicExam Year
AQA A-Level (UK - Pre-2017)C3Numerical MethodsIterative methods-
AQA A2 Maths 2017Pure MathsNumerical MethodsIteration-
AQA AS/A2 Maths 2017Pure MathsNumerical MethodsIteration-
CCEA A-Level (NI)C3Numerical MethodsIterative methods-
CIE A-Level (UK)P2Numerical MethodsIterative methods-
Edexcel A-Level (UK - Pre-2017)C3Numerical MethodsIterative methods-
Edexcel A2 Maths 2017Pure MathsNumerical MethodsIteration-
Edexcel AS/A2 Maths 2017Pure MathsNumerical MethodsIteration-
OCR A-Level (UK - Pre-2017)C3Numerical MethodsIterative methods-
OCR A2 Maths 2017Pure MathsNumerical MethodsIteration-
OCR MEI A2 Maths 2017Pure MathsNumerical MethodsIteration-
OCR-MEI A-Level (UK - Pre-2017)NMNumerical MethodsIterative methods-
Pre-U A-Level (UK)8Numerical MethodsIterative methods-
Scottish Advanced HighersM3Numerical MethodsIterative methods-
Scottish (Highers + Advanced)AM3Numerical MethodsIterative methods-
Universal (all site questions)NNumerical MethodsIterative methods-
WJEC A-Level (Wales)C3Numerical MethodsIterative methods-