Readme -- Pi

400 M Digits of Pi

Roland Werner, Ph.D.
Master Model Maker
Copyright 2002. All rights reserved.
Social Systems Simulation Group


1. Source of Digits
2. Source of Artwork
3. Organization of the CD
4. Some Observations
5. References
6. Other Interesting Links

1. Source of Digits
I would like to acknowledge Mr. Aoki Mitsuru, High Energy Physics Laboratory, Nagoya University, , for posting 400 million digits of Pi (excluding the first digit, 3) in manageable groups of 10 million digits. This computation of Pi was made around May 1998.

2. Source of Artwork
I would like to acknowledge Ms. Eve A. Andersson, cofounder of ArsDigita an open-source enterprise software company, , for providing the inspiration to the artwork for the jewel case and the CD.

3. Organization of the CD
Files on this beta version CD: (Java programs are currently under development; 02/2002.)

Readme.txt - This text.

Prog01.txt - A future Java demonstration Applet that will begin a random series of digits of length 'l' at the 'i'th digit.

Prog02.txt - A future Java demonstration program that will test the frequency distribution of these random digits using standard distribution tests, e.g., uniformity of integers 0 - 9, uniformity of decimals 0.00000 - 0.99999, poker test, runs test, independence test, gap test, odd-even test, ordered pairs test, n-tuples test, etc.

Prog03.txt - A future Java class that will provide a random series of integers between 0 and 9, or a random series of decimals between 0.00000 and 0.99999.

Forty files included are:
Pi01.txt - digits to 10M
Pi02.txt - digits to 20M
- digits to 390M
Pi40.txt - digits to 400M

Ranges.txt - This file is included for quality control and lists the first ten and last ten digits of Pi in each of the forty 10 M files above. Each of these files requires 9,766 KB of space.

The easiest way to view these large '.txt' files in the Windows environment is to use the following sequence of commands "Start/Programs/Accessories/WordPad." Then "Open" the file. The WordPad program can handle each 9,766 KB file.

The easiest way to view these large '.txt' files in the Mac environment is to use Microsoft Word TM. Use the following sequence of commands; "File/Open" and in the "List Files of Type" select "Text Files." This program can handle each 9,766 KB file.

Otherwise, any good text editor capable of handling these large files will do.

This beta version CD is available for $4.95 S&H from:

Social Systems Simulation Group
PO Box 6904
San Diego, CA 92166-0904

Phone/Fax 619-216-1601

4. Some Observations
When doing computer simulation, a good random number generator (RNG) is usually one of the first things sought after. Most of the RNG packaged with simulation software come close to the required accuracy for the social science simulation. Since they are pseudo RNG they suffer from any number of maladies that various tests listed in Prog02.txt program description above would reveal. Some of these problems are mitigated in modern applications by combining several methods and making the computations longer and more complex.

Some early examples of RNG are RAND (1955) that "were produced by rerandomization of a basic table generated by an electronic roulette wheel" (p. xi) and IBM (1959) that used the power residue method for binary or decimal machines. In both instances and into the present, the method of producing random number sequence relies on the internal electronics of the specific computer platform producing the sequence. The RNG is not platform independent.

The object today is to have a RNG that is completely platform independent. Therefore, in applications written in platform independent Java, a different approach from the past needs to be taken for sequences of random digits. The irrational number Pi or log (2) -- the logarithm of 2 to base e -- may provide just such a machine independence. (Peterson 2001:137)

Also, after a long sequence of numbers is produced, cycling of the sequence becomes a problem. When large numbers of digits or multiple streams of digits are required, this cycling weakness of the RNG becomes an "ominous" impediment to the reliability of the computer simulation. Pi has not yet been found to cycle.

To develop a baseline model for simulation, it must be tested time and again until an acceptable level of reliability of the model is established. During this testing phase the same series of random numbers is usually used over and over again until stability of the model is achieved. A resource, such as presented here, with a start at any nth digit of Pi provides such a sequence without having to recompute each time.

Most of these issues disappear when using a known sequence of random digits based on irrational numbers. Pi, an irrational number, is a good candidate for a sequence of digits that needs to be computed only once. It also does not seem to have the obvious distribution problems. One need only to read this sequence into the application once, start anywhere, and have a unique sequence of randomly distributed digits.

Pi is such a convenient sequence of random digits with these attractive features:

1. The series of random digits is platform independent.
2. This sequence has not yet been found to cycle even after 206 Billion digits.
3. The series needs to be computed only once and therefore saves computation time.
4. A long reliable sequence of random digits is available for model validation and testing.

The randomness of Pi has not as yet been proven mathematically. David H. Bailey and Richard Crandall, Berkeley Lab, are believed to be close to demonstrating this characteristic of Pi (Preuss 2001). Intuition supports the notion that the digits of Pi are indeed random, at least to the accuracy that any social science simulation requires. They have not yet been found to cycle.

"Kanada, by calculating 6,442,450,000 decimal digits in 1995, found the following frequency distribution for pi-3 up to 6,000,000,000 decimal places, which show no unusual deviation from expected behavior:

'0': 599963005 '1': 600033260 '2': 599999169 '3': 600000243
'4': 599957439 '5': 600017176 '6': 600016588 '7': 600009044
'8': 599987038 '9': 600017038 Chi Square = 9.00

Moreover, the speed with which the relative frequencies are approaching 1/10 agrees with theory. Consider the digit 7 for example. Its relative frequencies in the first 10^i digits (i = 1, . . ., 7) are 0, 0.08, 0.095, 0.097, 0.10025, 0.0998, 0.1000207, which seem to be approaching 1/10 at the speed predicted by probability theory for random digits, namely at a speed approximately proportional to 1/squr(n). The poker test is relevant to the question of normality in base ten, and Table 1 contains the frequencies of poker hands from the first ten million digits; there is no significant deviation from the expected values.

Type of hand Expected number Actual number
No two digits the same 604,800 604,976
One pair 1,008,000 1,007,151
Two pair 216,000 216,520
Three of a kind 144,000 144,375
Full house 18,000 17,891
Four of a kind 9,000 8,887
Five of a kind 200 200

Table 1: Distribution of the first two million poker hands in the digits of pi." (Wagon 1996:2).

"In 1999, Yasumasa Kanada and his colleagues at the University of Tokyo computed pi to a record 206 billion decimal digits. Their analysis shows that 7 appears 19,999,967,594 times among the first 200 billion decimal digits." (Peterson 2001:136).

The announcement of this record of calculating the number of digits of Pi (206,158,430,000) was made by the Information Technology Center, Computer Center Division, University of Tokyo in 1999. (Kanada 1999).

The conclusion I have reached from these observations is that errors in the fifth decimal are acceptable when generating five digit decimal random numbers between 0.00000 and 0.99999 from the enclosed series of 400 million digits. Even if these random decimals are changed to percentages (e.g., the error is in the third decimal and is still in the acceptable range of precision for social science simulation.

5. References
Andersson, Eve. 2001. "Pi.html." Retrieved November 11, 2001 ( ).

IBM. 1956. Reference Manual: Random Number Generation and Testing. White Plains, NY: IBM Corporation.

Kanada, Yasumasa. 1999. "Pi News by Kanada Laboratory." Retrieved February 5, 2002 ( ).

Mitsuru, Aoki. "Otanoshimi Page - Multiple Digits of Pi." Retrieved November 5, 2001 ( ).

Peterson, Ivars. 2001. "Pi a la Mode." Science News 160:136-137.

Preuss, Paul. 2001. "Are the digits of Pi Random? Lab Researchers may hold the key." Berkely Lab Research News. July 23. Retrieved November 14, 2001 ( ).

RAND. 1955. A Million Random Digits with 100,000 Normal Deviates. Glencoe, IL: The Free Press, Publishers.

Wagon, Stan. 1996. "Is Pi Normal?" Retrieved December 5, 2001 ( ).

6. Other Interesting Links
Dana's Pi Pages -

Freunden der Zahl Pi -

Friends of Pi Club -

The Joy of Pi by David Blatner -

Pi-Search Pages -

Table of Computation of Pi from 2000 BC to Now -


Social Systems Simulation Group
P.O. Box 6904
San Diego, CA  92166-0904
Roland Werner, Principal
Phone/FAX  (619) 660-1603

Copyright © 1996-2004 Social Systems Simulation Group.
All rights reserved.