Pi Unleashed
Pi Unleashed
U N LEA SHE D
3 14= "3.1415":
(=-* 3 14, 3 14
++ I ++ 3 14159)
for (- 31415 = _,
1; 31415++) write (
3,14), 3141592654[
"0123456789",
"314"
puts*
3141592654=0
;_314=-*"3.141592";}
~(i5J'$:!.~.l"1
Springer
Springer
Berlin
Heidelberg
New York
Barcelona
Hong Kong
London
Milan
Paris
Singapore
Tokyo
Pi - Unleashed
Translated from the German
by Catriona and David Lischka
With CD-ROM
Springer
Jorg Arndt
Hiihlweg 37
95448 Bayreuth, Germany
Christoph Haenel
Waldfriedenweg 24
82223 Eichenau, Germany
Nil desparare
(Do not despair)
Contents
1.
2.
21
21
21
24
25
28
30
32
3.
Shortcuts to 7r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1 Obscurer approaches to 7r . . .
3.2 Small is beautiful .................................
3.3 Squeezing 7r through a sieve. . . . . . . . . . . . . . . . . . . . . . ..
3.4 7r and chance (Monte Carlo methods) . . . . . . . . . . . . . . ..
3.5 Memorabilia......................................
3.6 Bit for bit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
3.7 Refinements......................................
3.8 The 7r room in Paris. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
35
35
37
38
39
44
47
49
50
4.
51
51
55
63
64
5.
Arcus Tangens . .. ... .... .. ..... .. .... .. ... ... ... ....
5.1 John Machin's arctan formula ......................
5.2 Other arctan formulae. . . . . . . . . . . . . . . . . . . . . . . . . . . ..
69
69
72
Contents
6.
77
78
80
82
84
7.
Gauss and 7r . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
7.1 The 7f AGM formula. . . .. .. ... .. .. .... .. . .. ... . .. ..
7.2 The Gauss AGM algorithm. . . . . . . . . . . . . . . . . . . . . . . ..
7.3 SchOnhage variant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
7.4 History of a formula. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
87
87
90
92
94
8.
Ramanujan and 7r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
8.1 Ramanujan's series ................................
8.2 Ramanujan's unusual biography. . . . . . . . . . . . . . . . . . . ..
8.3 Impulses .........................................
103
103
105
110
9.
113
7r
131
132
135
145
146
149
150
12. Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
12.1 A 7f quiz .........................................
12.2 Let numbers speak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
12.3 A proof that 7f = 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
12.4 The big change ...................................
12.5 Almost but not quite . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..
12.6 Why always more'? ................................
153
153
154
155
155
156
158
Contents
XI
158
160
162
164
165
167
170
185
198
203
205
206
207
209
209
211
213
16.
7r
239
239
240
241
242
243
244
245
247
247
248
248
250
XII
Contents
250
251
253
253
254
255
ftp://pi.super-computing.org/README.our-1atest~ecord
decimal place was reached. Since 1997 and from 51 billion digits, only
Kanada and his team are still in the running.
The computers used to attain these world records have generally been supercomputers which were specially developed for numbercrunching and cost millions of dollars. For example, Kanada achieved
his latest record on a Hitachi SR8000 with 128 processors. Nevertheless, if one has the skill it is possible to make smaller computers perform 7r calculations which are still competitive. In the history of the
world records there have been several examples of this. Thus, for example, a few years ago the above-mentioned Chudnovsky brothers calculated their 8 billion decimal digits of 7r in New York on a computer
which they had built themselves from parts purchased in department
stores [92].
One might expect Kanada to record his 7r calculations in compressed form 2 on around 150 CDs and to offer them for sale to interested parties. However, the professor seriously views his 7r as "noncommercial digits" and will only release them after checking carefully
that they are to be used for scientific purposes. He will only allow the
first few billion digits to be downloaded over the Internet from his
server in Tokyo. This itself is not a trivial task since, with a nprmal
telephone line, downloading the data would take approximately one
day per billion digits (with the associated expense). If the explosion
in the capability of computers continues, it will soon be quicker and
simpler to calculate one's own 7r to a suitable length than to download
it from elsewhere. When one is dealing with a few hundred million
digits this is in fact already the case today. And even a sophisticated
7r program will always be shorter than the number of digits to which
it can calculate.
What is the point of having such a long representation of 7r? One
obvious task is to search through the digits looking for rare or unusual
patterns and possibly for lengthy sequences of the same digits. For the
first few thousand digits, which are shown on page 240ff. of this book,
it is probably still feasible to do this without a computer. Above that
limit, however, one will probably need a search program, for example
our piseek program, which is included on the enclosed CD-ROM along
with the first 400 million digits of 7r and should provide a few hours'
pleasure.
2
926
535
Where does the sequence 0123456789 first appear in 7r? It was only
in 1997, at the time of the last but one world record, that this obvious question was finally answered. In fact that sequence does not occur until position 17,387,594,880, i.e. long past the 6.4 billionth digit,
which was previously the furthest that was known. But, if this special
sequence does not occur until that late, another special sequence, consisting of 10 digits all different from each other, occurs relatively early,
commencing in position 60. Even in the 17th century, mathematicians
had calculated 7r this far, as the history of 7r world records shows on
page 205.
Number fanatics might perhaps search in 7r for "self-referential positions", in which the numeric sequence is the same as the position
number. The first such position occurs right at the beginning, namely
in position 1. Other examples are to be found at positions 16,470
and 44,899, but after that there are no further instances until posi3
http://www.aros.net/-angio/pi_stuff/piquery
is equal to 7r, which can be transformed into a square with the same
area with the aid of (unmarked) compass and straight edge; but in
this - non-Euclidean - geometry a straight line cannot be drawn with
a ruler.)
After Lindemann had resolved the problem of the Squaring the
circle once and for all in 1882 (even if his achievement was only to
demonstrate that the problem cannot be resolved), one would have
expected all further attempts at a solution to cease immediately. It
is all the more amusing to find that despite Lindemann's proof a lot
of people continued to try to solve the problem, and they are still at
it even today. Dudley writes about such "mathematical cranks" in a
monograph [50], in which he mentions amongst others the ship builder
O.Z. (Otto Zimmermann) from Hamburg who published a book entitled "7r is rational" in 1983. In his book Dudley also classifies those who
have attempted to square the circle. According to this, O.Z. is a member of that relatively rare species who keep revising their opinion over
time: before 1975 his construction produced 7r = 3.1415926535576,
then up to January 1976 it was 3.141592653598, while from then on
7r amounted to exactly 3.1428.
is the ratio of the circumference c of a circle to its diameter d;
7r = C : d. This is the classic geometrical definition of the number. The
popular rule that 7r is the circumference of a circle with diameter 1 is
based on this.
A second geometrical definition states that 7r is the ratio of the
area of a circle A to the square of the radius r of the circle i.e. it is
determined by the relationship 7r = A : r2. This results in the obvious
statement that the ratio of the area of the circle to the area of the
surrounding square is given by 7r : 4.
The oldest Indo-Germanic cultures were already aware, thousands
of years Be, that a fixed ratio exists between the circumference and
the diameter of all circles, large or small. The second fixed ratio in
the circle, namely the relationship between the area of the circle and
the square of the radius, was also known unimaginably long ago, even
though this is less obvious than the first. On the other hand, it was
considerably later, perhaps not until ancient Greece, that it was appreciated that both these relationships involve the same ratio, 7r. This fact
is not readily understood. The picture below is perhaps the simplest
way of examining the concept:
7r
radius
circumference
In the picture on the left, a circle has been divided into a number of
equal-sized "slices of cake". If one imagines that the slices were taken
out and arranged side by side in a rectangle, they would appear as
shown in the picture on the right. The greater the number of slices,
the more the outline of the rectangle approximates the length of the
circumference of the circle, while the height of the rectangle approaches
the length of the radius of the circle. The rectangle in the picture is
only half occupied by the cake slices, and is therefore twice as big as
the sum of their areas, which is equal to the area of the circle. Thus, if
7r appears in the formula for the area of the circle, then it also figures
in the calculation of the circumference.
In addition to the geometric definition of 7r, there are many other
definitions, including ones drawn from quite different contexts. For
example, 7r appears in interesting probability problems.
What is the probability that a coin tossed an even number of times
will land an equal number of times on its head and on its tail? From
one's schooldays one may recognise the formal treatment of such exercises: if the coin is tossed 2n times and there are two possible outcomes
per toss, then altogether there are 22n possible outcomes, of which
will be the desired outcome. The probability of this is therefore
2n
p = e:)/2 , or
e:)
1 x 3 x 5 x ... x (2n - 1)
(1.1 )
2 x 4 x 6 x ... x
2n
This fraction is difficult to calculate for large values of n. We have
John Wallis (1616-1703) to thank for calculating it before infinitesimal
analysis was invented. Following an interesting train of thought, he
discovered that the infinite product comes to
3x3x5x5x7x7x ...
4
(1.2)
2x4x4x6x6x8x ...
7r
It is not difficult to see [123] that this Wallis product occurs in the
formula for the calculation of p shown above, and in such a manner
that
p=---------~
10
p~l/~
(1.3)
or
1 vI 0
4
7f
11 VI 2
dx
x dx
x4
= lim - 2 '"'
n-too n ~
k=O
Jn2 -
(1.4)
x4
k2
(1.5)
7f
11
http://pi314 . at/
12
of interest payable on it was 100% per interest period and this interest
period became ever shorter, from a year to half a year, three months
etc. until eventually it became "infinitesimally small". The answer to
this question is that the end value is e times as great as the initial
investment.
The number e has been calculated to far fewer digits than the number 7f. As of February 1999, 200 million digits had been calculated by
Sebastian Wedeniwski, exactly one thousandth of the number of digits
to which 7f has been calculated. (The Chudnovsky brothers are said
to have calculated e to 1 billion digits, but this has not been officially
confirmed.) Due to this disparity it is assumed that e is in principle
more difficult to calculate than 7f, but this has not been proven.
The latest world record makes 7f the mathematical constant which
has been calculated to the greatest number of decimal places. The
inverse value of 7f, i.e. ~ = 0.3183098661 ... , has similarly been calculated to 206.1 billion decimal places. Then comes the square root
of 2 (y'2 = 1.4142135623 ... ), with 137 billion (~ 237 ) decimal places
calculated. All three calculations have been performed by Kanada.
These are followed (as of October 1999) by e = 2.7182818284 ... (as
mentioned above, either 1 billion or 200 million), Riemann's number ((3) = L:~=1 ~ = 1.2020569031 ... (128 million) and In(2) =
0.6931471805 ... (108 million).
A table of such world records can be found on the Internet at
http://www.lacim.uquam.ca/pi/records.html.
Not only are the first 206.1 billion decimal places of 7f known, but
individual digits beyond that are also known. Thus, for example, since
February 1999 we have known the 10 trillionth digit of 7f from its
hexadecimal representation, an A. This and other such astonishing
findings resulted from the use of a new approach to the calculation
of 7f which was discovered quite by surprise in 1995. This subject is
discussed in Chapter 10.
Whereas the decimal representation of the 206.1 billion 7f digits is
still awaiting an artistic representation, the formal representation of 7f
is always an art at the same time. No doubt the fact that there are
grandiose formulae for 7f has contributed to its fascination. Here is a
selection of the available formulae, arranged in historical order:
13
(1.6)
7f
2
2
2
The formula shows that 7f can be expressed solely in terms of the
number 2 (Compare the formulae (16.137) on page 234).
2. Lord William Brouncker (c. 1620-1684) made his mark in 1658
with the first ever continued fraction for 7f:
4
12
(1.7)
;: = 1 + -----3"2---
2+-------;;--52
2+--~,.--
72
2+-2+ ...
The unusual feature about this continued fraction is the fact that
it contains a regular pattern (12, 32, 52, ... ), however the price for
this is that it is not a simple continued fraction as its numerators
do not = 1. There is also a simple continued fraction for 7f, but, as
mentioned, it does not exhibit any regularity.
3. From 1650 to at least 1973 virtually all calculations of 7f were
performed using arctan formulae. The arctan formula used most
frequently was first developed by John Machin (1680-1752), who
used it in 1706 to generate what was then a world record of 100
decimal places:
7f
1
1
- = 4 arctan - - arctan (1.8)
4
5
239
4. The next sequence discovered by the Indian mathematician S. Ramanujan (1877-1920) in 1914 has the attraction that it converges
extremely quickly. Every term in this series produces 8 accurate
digits of 7f:
~=
7f
v's
(4n)! (1103
9801 ~ (n!)4
26390n)
396 4n
(1.9)
5. But of all the mathematical formulae, the prize goes to the following theorem by Leonhard Euler dating from 1743. It combines five
base quantities 7f, e, i, 0 and 1) and four basic operators (+, =, .
and exponentiation) into a single expression:
14
(1.10)
This formula has always held a certain fascination, possibly because it is attractive to look at, although it is not at all easy to
understand. What it says is that that if the transcendental number
e is first raised to the power of the transcendental number 7r and
then raised again by the imaginary number i, the result is equal to
-1.
After the important American mathematician Benjamin Peirce
(1809-1880) had proved the formula to his students, he cried:
"Gentlemen, that is surely true, it is absolutely paradoxical; we
cannot understand it, and we don't know what it means. But we
have proved it, and therefore we know it is the truth." [39, p. 585].
In the meantime there is at least one relationship between
e which comes out without imaginary numbers [73, p. 98]:
e+1 =2+4I:
1
e -1
r=l (27rr)2
+1
7r
and
(1.11)
15
16
of fit of the two approximations was the fact that Archimedes and his
polygon method determined the direction in which virtually all succeeding 7r mathematicians proceeded for nearly 2000 years. Over the
centuries mathematicians increased the number of sides in the polygons used for the calculations until by the end of this era of geometric
approximation in 1630 AD, 7r was known to 39 decimal places.
The second era began in the middle of the 17th century after the
discovery of infinitesimal analysis and infinite expressions. A specific
method, namely the arctan formulae method (see Chapter 5), dominated 7r calculations after that for more than 300 years until around
1980. The first extensive calculation of 7r on this basis produced exactly 100 digits in the year 1706 (using paper and pencil), and the last
one in 1973 (using a computer) somewhat more than 1 million.
We are currently in the third era of 7r calculation. It began around
1980 when mathematicians discovered how to utilise a combination of
three independent developments.
The first development was the speeding up of an apparently simple
arithmetic operation, namely the multiplication of long numbers. As
this is the primary operation involved in calculations of 7r, speeding it
up reduces the total time required by a similar amount. Surprisingly,
the new method of multiplication known as FFT multiplication has
only been around since 1965. Under this method, the time required
to perform multiplication operations no longer rises quadratically as
the number of factors is increased, as had been the case in what was
previously virtually the only multiplication "school", but more or less
linearly. In Chapter 11 we discuss this subject in more detail; a numeric
example in that chapter indicates that the time required to multiply
two factors each of one million digits using the new multiplication
procedure is reduced from one day to three seconds.
The second major breakthrough was the development of highperformance algorithms specifically designed for calculating 7r. They
surpass the arctan formulae by several orders of magnitude.
To the extent that these algorithms still utilise infinite series, they
are much more productive than even the best arctan series. We have
already mentioned such a series produced by Ramanujan with 8 digits
per series term (1.9). An even more effective series was developed by
the Chudnovsky brothers (8.7), who used it in 1989 to calculate 15
digits per term and thus to attain what was then a world record of
1 billion digits.
17
Why?
What motivates people to pursue those elusive 7r digits? For practical
calculations, 10 or even fewer digits are generally sufficient. 39 digits of
7r are sufficient to calculate the volume of the universe to the nearest
atom. Some scientific applications require intermediate results with
significantly more digits than the final result, but we are talking here
of no more than a few hundred digits. It is conceivable that studies of
mathematical problems using computers could require a few thousand
digits, but certainly no more than that [13J. The precision to which
7r can be calculated far surpasses any practical need, so why continue
beyond that?
18
19
Someone once said that one can turn a normal person into a 7r fan
but that the reverse is impossible. He was quite right. The enthusiasm
and pleasure which leaps out of texts written by 7r digit-hunters suggests that 7r lives a life of its own in these people. The authors have
certainly been caught by the bug.
And last but by no means least, new discoveries about 7r meet
with the interest even of people who are not mathematicians. Put
another way, 7r matters. 7r is one of those rare objects in mathematics
which act as a showpiece. The hunt for ever more 7r digits provides
the opportunity to gain an insight into the research laboratories of
mathematicians, who otherwise tend to live out of sight of the public.
New goals
For some years, since around 1995, 7r mathematicians have increasingly
been turning to new goals. "Pi: a 2000-year search changes direction,"
so Victor Adamchik and Stanley Wagon describe the new trend [2]. Instead of continually calculating more 7r digits all over again, people are
now devoting ambition and resources to the calculation of individual
digits at the far end of 7r.
The impetus for this new development came from the unexpected
discovery of a method which allows individual hexadecimal digits in 7r
to be calculated without having to calculate all the digits which come
before. The basis for this is the following new formula:
7r
1 (4+
~ 16n
00
8n
1)
1 - 8n + 4 - 8n + 5 - 8n + 6
(1.12)
20
When the inventors of the "BBP series" (named after the initial
letters of their names) introduced the new theory, they also delivered
proof of its efficacy with the announcement of the identity of the 10
billionth hexadecimal digit of 7r, which at the time was far off from
discovery.
The new idea seems to have electrified 7r researchers all around the
world. Since then they have found more formulae of the same type as
the BBP series and even an algorithm for generating additional such
formulae. It was with one of these new formulae that digits 100 times
further on in 7r than the last 7r digit calculated by Yasumasa Kanada
were successfully calculated.
The most recent and youngest world record holder in this 7r discipline is Colin Percival, who was only born in 1981 and has only recently
gone up to university. Unlike Kanada, he did not perform his individual digit calculations on a university supercomputer but divided up the
calculations over 1700 computers on the Internet all over the world.
He invited owners of computers to help him with his project, called
the PiHex project, and sent them his calculation program bye-mail,
which the computers then executed in their dead time when they did
not have anything more important to do. Every computer took on a
different subtask and Percival then put the individual pieces together.
In this way after two years elapsed time and almost 700 years of computer time (P90 CPU) he attained a new world record on the 11th
September 2000: he had found the 250 trillionth hexadecimal digit of
7r, an E. Because this E consists of the four binary digits 111 0, Percival
was able to proudly announce: 6 :
http://www.cecm.sfu.ca/projects/pihex/announcelq.html
2.1 Probabilities
What is the probability that decimal position s of 7r will contain the
digit z?
At first glance the answer appears quite simple. Because position s
must be occupied by one of the 10 decimal digits 0,1, ... ,9, the probability of anyone of them occurring is exactly 10%.
On the other hand, a so-called probability subjectivist, i.e. a follower of the teachings of Thomas Bayes (1702-1761), would say that
the answer depends on how much he already knows about 7r, since according to this philosophy, "probability" measures the extent of what
one does not know. If he already knows which number occurs in position s, then the probability that it is a z is either 0% or 100%. If on
the other hand he knows nothing about position s, then as far as he
is concerned the probability that the number will be z is 10%. "No!"
mathematicians or followers of classical philosophy will respond, "the
basic question is fundamentally flawed." For the positions of 7r are not
random but precisely determined. For example, in the second decimal
place there is a 4, so there is no point in asking what the probability
is that a 5 will occur in that position. Where certainties reign, there
is no need for probabilities.
But if the basic question is now not a reasonable mathematical
question, is there another question which we can ask about the "randomness" of 7r? There is indeed: "Is 7r normal?"
2.2 Is
'iT
normal?
22
number the digit 0 occurs with a frequency of 1/10 and the sequence
of digits 357 with a frequency of 1/1000.
If all ten digits occur equally often in a decimal number, it is said
to be "simply normal" .
The question as to whether a number is normally distributed is
only meaningful and interesting if it is of infinite length. The number 7r
has been proven to be irrational, i.e. it is a number that contains an
infinitely long and non-periodic decimal fraction, and therefore it is
possible that it could also be normal. But we do not know this. No one
has succeeded in proving either that 7r is normal or that it is not. Nor
has anyone been able to demonstrate that such a proof is impossible.
If 7r were not normal, then this would manifest itself in individual
digits or sequences of digits occurring at unequal probabilities. For
example, the number 7 might occur more frequently than 3, or perhaps
from some point in the sequence there would be no further instances of
the combination 314159265. Although there are certainly intervals in
which such irregularities (or regularities, depending on how one looks
at it) occur, it is not known today whether this is also the case when
one views the entire sequence of 7r.
In a number which is normal, there should always be a point somewhere where, say, the number 5 occurs a million times in succession.
But we do not know whether such a sequence also occurs in a number such as 7r, of which we do not know whether or not it is normal.
In a random sequence it easy to find an interval which apparently is
non-random.
One thing is certain: the digits of 7r are not random numbers because they can be calculated.
The fact that 7r is not only irrational but also transcendental does
not exclude the possibility of regular patterns occurring within its
number sequence. Conversely, the existence of a pattern in the decimal
sequence of 7r does not mean that 7r is "non-normal". To illustrate
this point, let us consider the artificial number 0.123 ... 10111213 ...
which is made by writing all the natural numbers n in sequence after
the decimal point. Clearly this number follows a pattern, yet it is
normal. This has been proven by Ivan Niven [86].
The preoccupation with the question of whether 7r is normal has
provided the impetus to many statistical studies. The results of these
studies are in part instructive, in part disappointing, in part curious.
We will now report some of those findings.
2.2 Is
'IT
normal?
23
Pattern
abcde
aabcd
aabcd
aaabc
aaabb
aaaab
aaaaa
Actual number
604,976
1,007,151
216,520
144,375
17,891
8,887
200
Expected number
604,800
1,008,000
216,000
144,000
18,000
9,000
200
The comparison does not exhibit any striking departures from the
numbers one would expect. In fact, the X2 test produces the value of
53% for this distribution, which means it is completely normal with
no striking features. Only if percentages above 95% or below 5% were
obtained, would one view a distribution as "suspect".
If one considers smaller intervals, e.g. intervals of 500,000 decimal
places, which are sufficiently large to allow one to expect even the
rarest poker hand, "5 identical", to still occur 10 times, the picture
is different. For example, the interval from 3,000,001 to 3,500,000 has
the following distribution:
24
Poker hand
All different
One pair
Two pairs
Three identical
Full house
Four identical
Five identical
Pattern
abcde
aabcd
aabcd
aaabc
aaabb
aaaab
aaaaa
Actual number
30,297
50,263
10,877
7,156
927
459
21
Expected number
30,240
50,400
10,800
7,200
900
450
10
In this case, an opponent would very likely suspect that all was no
longer as it should be, especially if he examined the number of "Five
identical". The probability that this distribution occurs in a random
sequence is only 2.6%, so the alarm bells would definitely start ringing.
On the other hand, in the next equal-sized interval, the probability
reverts once more to 69.5%, and when one considers both intervals
together the overall probability is 32.0%, which would certainly not
arouse suspicion.
There is also the possibility of the opposite occurring, namely that
the distribution of the poker hands matches the expected values so
exactly as once again to look suspicious. Such an interval begins, for
example, in position 4,250,001. In that sequence the distribution of
poker hands is only 0.5% away from the expected figures.
2.3 So is
1('
not normal?
In an early edition of his "Mathematical Games" column Martin Gardner reports a conversation with a "Dr. Matrix" [54]:
"Dr. Matrix borrowed my pencil and rapidly jotted down the value
of 7r to 32 decimals."
(l,
yY
Yy
25
"Mathematicians consider the decimal expansion of 1r a random series, but to a modern numerologist it's rich with remarkable patterns."
He bracketed the two appearances of 26. "Twenty-six, you observe,
is the first two-digit number to repeat. Note how the second 26 marks
the center of a bilaterally symmetric series." Dr. Matrix inserted vertical bars to enclose 18 numerals, then bracketed six other number pairs
shown in the illustration. "The number pairs 79, 32 and 38 on the left
are balanced by the same three pairs in reverse order on the right!" He
also called attention to the sets of five digits on each side of the first 26:
"The first set sums to 20, the number of decimals preceding the second
26. The second set sums to 30, the number of decimals preceding the
second bar. Together they sum to 50, the two-digit number following
the last bar. The sequence between bars starts with the 13th decimal
and 13 is half of 26. The three pairs - 79, 32 and 38 - have six digits
that sum to 32, the pair in the middle as well as the total number of
decimals shown. The 46 and 43 on each side of the second 26 sum to
89, the number pair preceding the first bar. .. "
(2.1)
looks particularly contrived. It contains nothing but "unusual" components - the transcendental numbers e and 1r and the prime number
163, plus a square root and an exponentiation. Anyone would suppose
that the combination of such numbers must be an "awkward" number.
But in fact expression (2.1) produces the following remarkable result:
e7rv'f63
= 262,537,412,640,768,743.9999999999992...
(2.2)
26
n
6
17
18
22
25
37
43
58
59
67
74
163
2,197.990 .. .
422,150.997 .. .
61,4551.992 .. .
2,508,951.998 .. .
6,635,623.9993 .. .
199,148,647.99997.. .
884,736,743.9997 .. .
24,591,257,751.9999998 ...
30,197,683,486.993 ...
147,197,952,743.999998 ...
545,518,122,089.9991. ..
262,537,412,640,768,743.9999999999992 ...
The author of the list, Roy Williams, offered a prize for anyone who
could either convincingly demonstrate that this is a chance occurrence
or else explain to an intelligent university graduate why it is not a
chance occurrence.
One thing is certain: the length of the list alone suggests that not
all of these instances are chance. The list is actually not even complete, as there are many other values of n above 163 for which e'TrVn
produces three or more nines after the decimal point, for example,
n = 232(5 nines), 719(4), 1169(4), 1467(8),4075(5),5773(4).
But knowing this does not make us any the wiser. For the mathematical proofs are so complicated that, however highly one rates university graduates, the prospects of winning the prize are extremely
slim because the phenomenon defies simple explanation. The topic be-
27
?je7rv'I63 -
744
= 640319.9999999999999999999999993. . .
(2.4)
There are a few other values of n for which approximating series expansions can be used by way of explanation, even if they cannot explain the j function. The Indian mathematician S. Ramanujan
(1887-1920), of whom we shall hear more in Chapter 8, discovered
some such series. However, he was not given to lengthy explanations,
and his essay [96J is no exception. As far as one can tell, he followed
a semi-heuristic path which involved combing through the first few
hundred degrees of modular equations. In the course of so doing he
came across the degrees 22, 37 and 58, which in a certain combination actually produce integers. For example, he found the relationship
e 7rV37 = 64((6 + v'37)6 + (6 - v'37)6) - 24 - 4372e- 7rV37 - ... , wh~se
approximation then "explains" the case of n = 37 in the list if one
leaves out the terms after the - 24.
With these six values of n, those n which are bigger by a quadratic
factor are then also explained, e.g. n = 232 = 58 . 22 or n = 1467 =
163.3 2. But we are still no closer to explaining the (many) other cases,
e.g. the spectacular case of e7rV7T9 which is only 0.000013 away from
an integer.
The assumption that combination of many complex variables inevitably produces a complex result is deceptive, as we have seen. This
28
Number
1
2
3
4
5
6
7
8
9
Total
29
Occurrences
20,000,030,841
19,999,914,711
20,000,136,978
20,000,069,393
19,999,921,691
19,999,917,053
19,999,881,515
19,999,967,594
20,000,291,044
19,999,869,180
200,000,000,000
As you see, the numbers are very evenly distributed. The number
which deviates most is the number 8, but even this number deviates by
only 0.00001% from the mean. The X2 test produces a probability of
around 55% for the randomness of this distribution, i.e. "statistically
insignificant" .
Kanada also searched through his record-breaking 7r for interesting patterns. He reports, for example, that the sequence 01234567891
occurs five times among the 206.1 billion decimal places of 7r, which
is somewhat striking as one would only expect this sequence to occur
twice. Another peculiarity is the fact that the sequence 543210987654
appears for the first time relatively late in 7r, at the end of the 206
billion, in position 197,954,994,289, although there is a 50% probability that this sequence would appear in the first 69 billion decimal
places. This probability figure is obtained from inserting w = 0.5 and
k = 11 in the formula below (2.5), which states that the probability of
a k-digit number not appearing in a number containing n digits is
logw
n
w
= log(l _ lO-k)
= (1 - lO-kt
(2.5)
(2.6)
According to the inverse formula (2.6), the probability of the fact ascertained by Kanada (despite the inherent difficulty of making such a
statement) is only 13%. Even so, such numbers would not arouse the
suspicion of any statistician.
If one divides up the digits of 7r into blocks of 10 decimals, what
is then the probability that any given block will consist of all dif-
30
ferent numbers? One such block could, for example, be the sequence
0123456789.
There are three points to make here.
Firstly, the probability of this case is greater than one might think.
We are looking for 10! hits out of a total 1010 possibilities. This fraction
can be calculated easily with a pocket calculator, and the result is
the astonishingly large value of around 0.036% = 1/2755 .... In other
words, a block of 10 different figures will occur on average as frequently
as every 2755 blocks.
Secondly, in reality this case actually occurs much earlier than is
suggested by this probability, which is already quite large. In fact a
hit occurs as early as the seventh block, as you can see from this list
of the first seven blocks of 10 digits:
3.1415926535
8979323846
2643383279
5028841971
6939937510
5820974944
5923078164
Thirdly, this result is independent of whether the blocks begin before or after the decimal point of Jr, because the same number 4 appears
immediately before as well as at the end of the block.
7f
7r
31
to know 6.9 billion decimal places of 71", whereas at the time (1908) only
707 decimal places were actually known. So if one cannot say whether
this statement is true or false then, according to Brouwer, no one can
invoke the Law of the Excluded Middle for this statement.
Today, that question has been answered (thanks to Kanada), and
with it a number of examples which Brouwer and his disciples used
to prove their theory have been rendered of no value. One of these
examples was the following.
One of the implications of tertium non datur is that proof of the
impossibility of an impossible characteristic is also a proof of the characteristic itself. Brouwer's counterarguments went as follows. I write
down the sequence of decimal digits for 71" and underneath it the decimal fraction p = 0.33333 ... , which I terminate as soon as the sequence
0123456789 occurs in 71". If the 9 in the sequence is the kth decimal
place, then p = (10 k - 1)/(3 . 10 k ).
Now let us assume that pis irrational. If that is so, then p cannot be
equal to (10 k -1) / (31 Ok), as that would be a fraction and consequently
a rational number. Hence the stated number sequence should also not
occur in 71". But if it does not occur in 71", then p = 1/3, which again is
a fraction, contrary to the hypothesis.
In this way, the assumption that p is not a rational number leads
to a contradiction. Despite this we cannot assert that p is rational, as
that would mean that we would have to be able to state two integer
numbers p and q for the numerator and denominator of p, and to do
that we would either have to locate a sequence 0123456789 in 71" or else
to prove that there is no such sequence.
This and other examples were thus used by the Intuitionists to support their thesis that the Law of the Excluded Middle could not be
assumed to be always correct. Not only the example cited above but
many other examples were based on the assumption that we would
never know for certain whether the number sequence 0123456789 occurs in 71" or not.
Unfortunately for the theory, we do now know, and so the question
arises of whether this refutes the theory. In fact it does not. The proponents of the theory would only have had to choose a much longer
sequence in their examples, and they can still do that even today, for
example they could suggest a sequence consisting of 100 billion zeros
in 71", and everything would be back to the way it was before. Not only
is Intuitionism not refuted, but in a certain way it is even confirmed,
32
and, indeed, precisely through experimental mathematics, which comprises a lot of 7r research.
Mean
Mean
Mean
Mean
value
value
value
value
33
27.5
15.3
8.2
10.4
Is there anything in this? The mean value of the first 2048 elements
appears to be quite out of line. It is almost twice as big as the mean
value of all the elements and it is also significantly greater than the
mean of the two next equally large sections. The picture does not
change if one splits the number sequence up into smaller sections or
divides it in different ways: every time the first or at least the foremost
mean values are greater than those which come afterwards.
When one examines the data more closely, however, even this discovery turns out not to amount to much. The fact is that quite early
on, at position 431 of the continued fraction expansion of 7r, an unusually large element occurs, 20776, which has the effect of distorting
the statistics. In the first section of 2048 elements shown above, that
single element by itself accounts for 10.14 of the mean value. If one
ignores the influence of that element, then this first section becomes
inconspicuous.
It is unfortunately the case that the simple continued fraction of 7r,
like the decimal (and every other) representation of 7r, contains no
other message than that there is little regularity in the irregularity of
the number.
However, there are other continued fraction representations than
the simple continued fraction and in some of them there is a certain
amount of regularity. One example here is the elegant new continued
fraction for 7r which was developed by 1.J. Lange in 1999:
12
32 52 72
7r = 3 + (2 8)
6+6+6+6+
.
Lange, 1999 [80]
Here, all the elements follow the simple construction rule (2n~1)2
The known 7r digits pass all random number tests with flying
colours. For this reason one can use 7r as a random number generator
- though one must not reveal to "the opponent" where the random
numbers came from. For a lottery company it would not be a good
idea to simply select the next 7 digits of 7r as the hits each week.
So is there at least a ray of hope that a sensation might yet be uncovered in the digits of 7r? Perhaps. The above-mentioned Chudnovsky
34
3. Shortcuts to
7r
1r
- - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - -
36
3. Shortcuts to
1f
The "circle" here has an area of 201 (measured using the characters _ and - _) and a diameter of 16 (measured in lines made out of
these characters), so that a value of 3.141 is obtained for "7r". To obtain more decimal places, you need only to make the circle larger, each
additional decimal place requiring the size of the circle to be increased
by a factor of around 10.
The program does not look at all like an ordinary C program, but
it even complies with the ANSI C programming standard. With this
program, Westley took a prize at the International Obfuscated C Code
Contest (IOCCC) in 1988. This competition has taken place every year
since 1984 on the Internet. The winner is the person who creates the
most incomprehensible and most creative C program, which, however,
must be executable. The basic tools used are the concise C syntax
and above all the C pre-processor (as here). The results are usually
artificial yet also artistic. But they are invariably examples of how one
should not write a program.
Here is another example of such programming:
char
_3141592654[3141
]. __ 3141[3141];_314159[31415]._3141[31415] ;main() {register char*
_3_141.*_3_1415. *_3 __ 1415; register int _314._31415. __ 31415.*_31.
_3_14159. __ 3_1415;*_3141592654= __ 31415=2._3141592654[0] [_3141592654
-1] =1 [ __ 3141] =5; __ 3_1415=1;do{_3_14159=_314=0. __ 31415+ +;for( _31415
=0;_314153.14-4)* __ 31415;_31415++)_31415[_3141]=_314159[_31415]= 1;_3141[*_314159=_3_14159]=_314;_3_141=_3141592654+__ 3_1415;_3_1415=
__ 3_1415
+ __ 3141 ;for
C31415 = 3141__ 3_1415 ;
_31415;_31415-._3_141 ++.
_3_1415++){_314
+=_3142 ;
_314=1;_314+=
* _3_1415; _31
=_314159+ _314;
if(! (*_31+1)
)* _31 =_314 /
__ 31415._314
C3141]=_314 '/.
__ 31415 ;* (
_3 __ 1415=_3_141
)+= *_3_1415
= *_31;while(*
_3 __ 1415 >=
31415/3141 ) *
_3 __ 1415+= 10,(*--_3 __ 1415
C3141]; if ( !
) ++; _314= _314
_3_14159 && *
_3_1415)_3_14159
=1. __ 3_1415 =
3141-_31415;}if(
_314+( __ 31415
1= __ 31415 )
while ( ++ *
_3_141==3141/314
)*_3_141--=0
;}while(_3_14159
) ; { char *
__ 3_14= "3.1415";
write3,1),
(--* __ 3_14, __ 3_14
),(_3_14159
++,++_3_14159))+
3.1415926; }
for ( _31415 = 1;
_31415<31411;_31415++)write(
31415% 314-(
3,14),_3141592654[
_31415
] +
"0123456789" ,"314"
[ 3]+1)-_314;
puts *_3141592654=0
,_3141592654))
;_314= *"3.141592";}
37
Despite its short length, this little program calculates 15,000 decimal places of 7f.
The underlying calculation method is the so-called spigot algorithm, under which the program produces a steady trickle of digits
one at a time without using or requiring previously computed digits.
You can see the method in action for yourself if you run our J AVA
applet spigot/pispigot. htm which is on our CD-ROM. The spigot
algorithm and the little program are discussed in more detail in Chapter 6 from page 77.
This algorithm was discovered by Stanley Rabinowitz, who published it in 1991 in the form of a program written in FORTRAN [94].
The author provided virtually no explanation or proof, instead promising his readers all would be explained later on in a major article. This
appeared a mere four years later in 1995 [95] (with Stanley Wagon
as co-author). One can therefore say that programming of the spigot
algorithm preceded its rationale.
Our version shown above evolved in a number of stages, in which
several authors (Dik T. Winter, Achim Flammenkamp and others)
were involved.
38
3. Shortcuts to
3.3 Squeezing
1T'
7r
through a sieve
11'
1,2,4,6,8,10,12,14,16,18,20,24,26,28,30,32,34, ...
Starting from the fifth element, every third element is now removed:
1,2,4,6,10,12,16,18,22,24,28,30,34, ...
then, from the seventh element, every fourth element:
1,2,4,6,10,12,18,22,24,30,34, ...
and so on. As a general rule, on the kth pass, every (k + l)th element
is removed from the (2k + l)th element.
The procedure produces the sequence of values f(n) = {I, 2, 4, 6,
10, 12, 18, 22, 30, 34, ... }. When these values are sequentially entered
in the formula
f(n)
(3.1)
each result is a closer approximation to 11'. For n = 1,2,4, 8, 16, 32, ...
4096 = 212, the following approximations are obtained:
1,2,2.7,2.9,3.12,3.10,3.08,3.12,3.1405,3.13, 3.1423, 3.1414, 3.1412
Unfortunately the increase in accuracy is only modest. The series converges only of the order of O(n4 / 3 ), which is a little better than linear
convergence. Furthermore, the memory requirements are considerable:
to use f( 4096), as in the present case, for the approximation, one needs
a sieve with 5.34 million holes in it.
K.S. Brown discovered that the sequence of f(n) can also be obtained by intelligent rounding up . His algorithm goes as follows.
Take an integer n and round it to the next multiple of n - 1, then
to the next multiple of n - 2, and so on until the next multiple of 1.
The result is then exactly the same f(n) as one obtains from the sieve
procedure. For example, with n = 10, one obtains the intermediate
values 18, 24, 28, 30, 30, 32, 33, and 34, with the end result f(1O) = 34.
3.4
3.4
7r
7r
39
40
3. Shortcuts to
1f
1
1
7r~
A(circle quadrant)
A(board quadrant)
4t
n
= 7rr 2 /4
7r
4
(3.2)
(3.3)
The result is a neat algorithm for approximating 7r. You only need
to simulate a number of throws (as many as possible) and test on each
throw whether the dart lands inside the circle. This test is particularly
simple: if x and yare the co-ordinates of the landing point(O ~ x, y ~
1), then the point will be inside the circle precisely when its distance
from the origin is x 2 + y2 < 1, i.e. x 2 + y2 < l.
In the following C++ program the random co-ordinates x and y
are generated using the standard C++ function rand (); as this function delivers (pseudo-) random numbers between 0 and (the systemdependent variable) RAND..11AX, they must be divided again by RAND..11AX
to obtain co-ordinates in the interval from 0 to 1. The random number
generator is initialised through the standard function srand () with a
time-dependent, and hence varying, value:
vi
<iostream.h>
<stdlib.h>
<time.h>
<math.h>
3.4
7r
41
int main(void)
{
long
k, n, hits;
const double factor = 1.0
RAND_MAX;
while (1)
{
II Throw n tosses
for (k=hits=O; k < n; ++k)
{
return 0;
}
1r
and coprimality
The probability of two integer numbers chosen at random being relatively prime to each other is 6/1f2. This characteristic can be used for
another 1f approximation procedure, whereby a sufficiently large number of pairs of random numbers is calculated and these are examined
for coprimality. From the ratio of the number of coprime pairs t to the
total number of trials n the following approximation for 1f is obtained:
lim
n--+oo
!n
1f~
(3.4)
fP
(3.5)
1f2
42
3. Shortcuts to
11"
Instead of playing this game with students, one should try it with
a computer. The only problem with such a program is how to investigate the results for coprimality. Fortunately, for 2300 years there
has been an algorithm which does this and could be described as the
"grandfather" of all algorithms. It was first noted down by the Greek
mathematician Euclid (ca. 325-265 BC) and appears in Book VII of
his 13-volume Elements. This work is the most successful mathematics
book ever written and has been published more than 1000 times since
antiquity.
The Euclidean algorithm can be written down in only three lines
of source code (e.g. see the program listing below), although it takes
longer to explain in words. Starting from two integer numbers A > 0
and B > 0, it calculates the largest integer which divides into both A
and B without a remainder. If this "highest common factor" (HCF)
= 1, then A and B are coprime to each other. The algorithm utilises
the property that A = l~JB + C, with 0 ::; C < B. For example, let
us consider the integers A = 78 and B = 21. As 78 = 321 + 15, the
highest number which divides into both 78 and 21 is also the largest
number which divides into 21 and 15. Through iteration one obtains:
78 = 321 + 15
21 = 1 . 15 + 6
15
= 26 + 3
6=23+0
Hence 3 is the highest common factor of 78 and 21.
In the following little program we simulate the student experiment
and so arrive at an approximation for 7[,
II
II
II
II
II
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
int euclid(int u, int v)
{
int rj
while ( (r = u % v) != 0
{
3.4
u
7r
43
= v;
= r;
v
}
return v;
}
int main(void)
{
while (1)
{
int
n, nTries, nHits;
int A = rand() + 1;
int C = rand() + 1;
if (euclid(A, C) == 1) II A and C are relative prim
++nHits;
}
return 0;
}
Approximation for
3.464102
3.273268
3.194383
3.142438
3.143913
3.141554
1f
Error
+0.322509 ...
+0.131675 ...
+0.052790 ...
+0.000845 ...
+0.002320 ...
-0.000038 ...
44
3. Shortcuts to
7r
3.5 Memorabilia
Another way of arriving at decimal places of Jr is to learn them by
heart.
A number of mnemonic verses are available to assist with this. We
mentioned already such a verse in the first chapter. Many people gifted
at playing with words have tried to conjure up texts in which the number of letters in each successive word corresponds to the corresponding
digit of Jr.
An English poem intended to teach Jr to 31 decimal places was
submitted by a person "F. S. R." to the scientific journal Nature in
1905:
Sir,
3
send
In
sacred
truth
rhyme
excelling
and
rigid
spelling
Numerical
sprites
elucidate
For
me
the
lecture's
dull
weight
3.5 Memorabilia
45
http://users.aol.com/s6sj7gt/cadenza.htm
46
3. Shortcuts to
7r
Poe, E.
Near A Raven
Midnights so dreary, tired and weary.
Silently pondering volumes extolling all by-now obsolete lore.
During my rather long nap - the weirdest tap!
An ominous vibrating sound disturbing my chamber's antedoor.
"This", I whispered quietly, "I ignore" .
3.1
415
926535
897932384
62643383
27950288
419716
Perfectly, the intellect remembers: the ghostly fires, a glittering ember 9399375105
Inflamed by lightning's outbursts,
8209
windows cast penumbras upon this floor. 749445
Sorrowful, as one mistreated, unhappy thoughts I heeded:
92307816
That inimitable lesson in elegance - Lenore 406286
Is delighting, exciting ... nevermore.
2089
The title and the first two verses alone produce 80 digits of 11". These
are followed by a further 16 such verses plus the author's signature for
the other 660 places. Keith worked hard to remain as close to the
original as possible as regards the metre, action, melody and rhythm.
Thus for example he succeeded in retaining the melodious dark refrain
at the end of every verse.
Of the 14 sections of the Cadaeic cadenza, section 3 contains another poem by the mathematician and 11" enthusiast Charles Lutwidge
Dodgson, better known as Lewis Carroll, author of "Alice in Wonderland", which has likewise been adapted to 11", while section 11 even
contains a work by William Shakespeare (who we all know wrote the
famous words, "to 11" or not to 11"").
11" texts reach their first critical point at the 32nd decimal place,
when the first zero appears in the decimal sequence of 11". As there are
no words with zero letters, the authors of mnemonic verses have to
think up something special. Keith's solution to the problem is to use
words of 10 letters, such as, for example, "disturbing". Other authors
require their readers to interpret a punctuation mark as a O. A particularly difficult problem here is the 601st decimal place of 11", where a
sequence of three zeros occurs in succession.
Short after the 740 decimal places of "Near The Raven", in section 2
of his work, Keith had to resolve another tricky decimal sequence in 11",
the so-called Feynman point, for at position 762 there is a devilish
sequence of 7 numbers 9999998! This sequence may be beautiful to
47
7r aesthetes, but for poor Mike, who had to find a text containing a
sequence of six 9-letter words and one 8-letter word in succession, it
was bad news. Nevertheless, he succeeded in cracking it.
There are a number of methods of memory training which have
evolved from the example of 7r. These include: the use of recurring
patterns, creation of blocks of fixed or variable length, association of
graphic, rhythmic, musical or colour representations, learning by repetition at varying intervals and situations. There are articles available
on this subject on the Internet.
Anyone who knows a lot of digits of 7r will go far. For example
such a person can take part in a 7r recitation competition or become
a member of a 7r club, as these normally require one to be able to
recite a number of digits of 7r by way of entry test. We have already
mentioned the Austrian club "Freunde der Zahl Pi" (Friends of the
number Pi) which requires of candidates seeking admission that they
should be able to recite 100 decimal places in a public place in front
of a 7r notary. The Swedish "1000 Club,,2 even requires 1000 digits of
7r.
The members of these clubs are not just nut-cases who fill their
heads with digits of 7r, but serious scientists seem to take pleasure in
being able to perform this feat. One of these is Simon Plouffe, who
was one of the three mathematicians who recently developed a novel
7r algorithm, the BBP algorithm (see page 117). Plouffe obtained an
entry in the (French) Guinness Book of Records in 1977 by memorising
4096 digits of 7r. In fact, he said, he actually knew 4400 digits by heart,
but 4096, i.e. 212, was a nicer number.
Since 1995 the world record holder in the recitation of 7r digits has
been Hiryuku Goto, then aged 21, who recited 42,000 digits in nine
hours. Since this new record was established it has been claimed that
Japanese is better suited for memorising sequences of numbers than
other languages. Or perhaps Goto simply had nothing more sensible
to do after programmers had eliminated him from their code ...
http://www.ts.umu.se/-olleg/pi/club_l000.html
48
3. Shortcuts to
'IT
value is just the binary representation, in which only zeros and ones
occur.
To obtain the places after the decimal point in the binary representation of I/K from the decimal version, keep multiplying the decimal fraction by 2 and writing each calculated position in front of
the point as the next binary digit while keeping the fraction for the
next multiplication. Thus 0.3183 x 2 = 0.6366, hence 0 is the first
binary digit. 0.6366 x 2 = 1.2732, so the second binary digit is 1. Continuing with the post-decimal point result of the last operation, i.e.
with 0.2732 x 2 = 0.5464, the third binary digit is another O. And
so the procedure continues. Of course the precision of binary representation is not any higher than that of the decimal representation,
so that from n accurate decimal places one can obtain at the most
1/ 10glO 2 ~ 3.3 times as many accurate binary digits.
A quite different method for calculating the binary representation
of I/K was discovered by Simon Plouffe of Bordeaux University. His
procedure was proved and generalised in 1995 by Jonathan Borwein
and Roland Girgensohn [36].
In Plouffe's bit recursion method the starting point is ao = tan(l) =
1.5574 .... From this, succeeding values of at, a2, a3, .. . are calculated
using the following rule:
2ak
ak+l = -1--ak2
(3.6)
0
1
2
3
4
5
6
7
8
9
3.7 Refinements
49
3.7 Refinements
You might already have a few 7f digits and be wondering whether you
could build on them. You can. An elegant method for doing this was
developed by Daniel Shanks 3 [108].
If Po is an approximation for 7f which has n accurate digits, then
the following calculation step produces an improved approximation PI,
which is accurate to three times as many digits:
(3.7)
PI = Po + sin Po
PI = Po + sin Po
= 7f + E + sin( 7f +
= 7f +
= 7f
E-
+E -
E)
sinE
(:, -
~~ + ~~ - .. -)
E3
=7f+
6 -'"
7r
calcula-
50
3. Shortcuts to
P2 =Po+
=
2 sinpo - tanpo
3
7r
IT
(3.8)
+ 20 + ...
(3.9)
3.8 The
1f'
room in Paris
4. Approximations for
Fractions
7r
and Continued
or one of the many mathematical identities (see the collection which starts on
page 223).
52
4. Approximations for
7r(2)
223
22
71 < 7r < 7
7r
= 7r(2)
(4.1)
The fact that this approximation states an interval makes it particularly attractive, although the manner in which it was discovered has
its drawbacks. (For more on this, see page 171.) The notation used to
specify the interval makes clear that 7r does not exactly equal either
the left-hand or the right-hand limit, whereas representations of 7r have
not always been so honest. Thus, for example, Tsu Chhung-Chih, who
discovered the excellent approximation
7r(6)
355
113
(4.2)
in China c. 480 AD, was convinced that this fraction was exactly equal
to 7r.
An approximation is called "rational" if it can be represented by
a fraction consisting of integer numerators and denominators. Such
representations are extremely common, and all decimal, hexadecimal,
binary etc. digit sequences of 7r are rational approximations since, for
example, 3.14 is the fraction created by dividing 314 by 100. Because
there is a convention that with certain bases such as 10, 16 or 2 we only
"think" the denominator and do not write it, these approximations
are concise and effective. In actual fact, however, the approximation
7r(2) = 3.14 means not just 4 keystrokes consisting of a decimal point
and 3 numerals, but 7 keystrokes consisting of the fraction line and
two sets of 3 numerals in each of the numerator and denominator. But
if one is going to use the 7-keystroke version, there are other fractions,
e.g. the above-mentioned fraction 355/113 = 7r(6), which represent 7r
more accurately, in this case 4 decimal places more accurately.
A good rational approximation for 7r is one in which the ratio of
the number of correct decimal places to the number of digits in the numerator and denominator is particularly high. As we shall see shortly,
the best rational approximations in this respect attain the value 1.
The best source for good approximations of a (transcendental or
irrational) number is its so-called continued fraction. Under this remarkable, but very interesting representation, the denominators are
not, as in the decimal representation, powers of a fixed base number
but a combination consisting of an integer and a fraction.
In the case of 7r, the continued fraction begins as follows:
53
7r
= 3 + ---------:;-1----
(4.3)
7 + ---------,,1--15 + -----=-1-1+----.-292 +
1
1 + ...
bi
.0
.1
.2
.3
.4
.5
.6
.7
.8
.9
O.
3
3
1
2
7
1
84
15
14
2
6
292
1
1
1
1
1
15
2
1
2
3
2
1
2
13
1
2
1
99
2
2
1
3
1
2
4
5
1.
2.
3.
54
4. Approximations for
7r
10- 5
10- 10
10- 15
10- 20
ReI. error
10- 25
10- 30
10- 35
10-
40
84
14
15 13
99
It can be seen from the graph that if termination occurs before a large
element such as 15, 292, 84 or 99, the relative error drops off especially
sharply, so that excellent approximations are to be found at these
points:
Termination point
Before
b2=15
Before
Before
b4=292
Before
Before
b12=14
b21 =84
Before
b25=15
b27 =13
Before
b33=99
Approximation
7f(2) =
2:;-
7f(6) = fr~
7f(12) - 5419351
- 1725033
7f(21) - 21053343141
6701487259
(25)
8958937768937
7f
= 2851718461558
(29)
7f
= 428224593349304
136308121570117
7f(37) - 2646693125139304345
-
842468587426513207
In favourable cases, the number of accurate decimal places is almost equal to the sum of the number of digits in the numerator and
denominator. If one terminates the continued fraction before b4 = 292,
b21 = 84 or b33 = 99 (the biggest elements), the number of accurate
decimal places is exactly equal to the number of digits. There are
more such cases further on, e.g. before b77 = 16, b79 = 161 or b80 = 45.
55
An
1
I( -B - /'1,)1//'1, < A . B . b
n
n+l
(4.4)
1019514486099146
324521540032945
(4.5)
56
4. Approximations for
7r
J2 + v'3
(4.6)
and his fellow philosopher in India, Zhang Heng (78-139 AD), was the
first to work with the formula
7r(1) =
v10
(4.7)
The following approximation is attributed to the author of the "Divine Comedy", Dante Alighieri (1265-1321), who was highly educated
in mathematical matters:
7r(3)
v'2
= 3 + 10
(4.8)
The authors have been unable to discover who invented the following impressive approximation formula, but it may have been the
Indian astronomer Aryabhata, who was born in India in 476 AD.
7r(4) = 512
2-
2+
One might be tempted to think that the first minus sign was an error, but that is not the case. As one can easily check with elementary
geometry, the expression
v'2 is the perimeter of an octagon
which is inscribed in a circle of radius 1, i.e. with the circumference
27r. Every time the number of sides is doubled, the innermost v'2 is
replaced by the expression
+ v'2 and the factor in front of the outermost root is doubled. In this way, the above approximation specifies
half the perimeter of an inscribed regular 1024-sided polygon.
Due to the large number of 2s under the roots, the formula (4.9) resembles Franc;ois Viete's product of 1593 (1.6). In fact the two formulae
are related and converge in similar fashion. They both approach the
number 7r through inscribed 2n-sided polygons, in the case of Viete's
product through its area and in the case of the above formula through
its perimeter.
8J2 J2
J~O - v12
71'(4) =
57
(4.10)
while Carl Friedrich Gauss (1777-1855) was only 14 when he calculated [82, p. 8]:
71'(13)
22 . 2484 . 12983009
7 2485 12983008
(4.11)
The young Friedrich started from the known approximation 2:; and
then divided it into 3.14159265 .... He subtracted the quotient from 1
and converted the remainder to a fraction with the numerator 1. The
denominator is around 2485. He then proceeded in similar fashion with
22
'7 .
2484
2485'
= In -1
x
- 2x4
where
1
2
= -(24 - 1)/(24
+ 1)
(4.12)
9ti-
(4.13)
19
16 J7
(4.14)
71'(3)
=-+
71'(3)
71'(3)
7 ( 1+5
=3
(4.15)
71'(6) _ 99 (
7
)
- 80 7 - 3\1'2
(4.16)
71'(9)
V3)
63 (17 + 15)5)
25
7 + 15)5
(4.17)
58
4. Approximations for
11"(8) =
7r
92 + 19
(4.18)
22
Attempts have been made to find out what may have been concealed behind the word "empirically". The most likely explanation is
the following [25, p. 655]. Ramanujan was an expert in continued fractions, and so he probably noticed that the simple continued fraction
of 11"4 possesses a particularly striking term:
4
111111
11" = 97 + 2 + 2 +"3 + "1 + 16539 + "1 +...
(4.19)
This observation would have suggested to him that he should terminate
the continued fraction before the unusually large element 16539 and
use it to find 11"4 ~ 97 +
= 9 +
Ramanujan obtained another empirical approximation by improving the approximation 355/113. From this he found, "simply from creating the inverse value of 1 - (11311"/355)",
4
i2
11"
2 Ii; .
(4.20)
11"(15) =
10
~
In (V 10 + llv2 + V + 7v2)
V142
4
4
(4.21)
11"(18) =
(4.22)
J61 + 20v'lo) ]
59
(4.23)
(/9+: V6 +j5+:V6)'j
(4.24)
7r(2)
= 3(3~ +
7)
(4.25)
_ 103v'I3 + 125
7r (5) 158
(4.26)
7r 7 _
66y'2
( ) - 33J29 - 148
(4.27)
7r(8) =
4
RO
v58
In(396)
7r 9 _
180 + 52y'3
( ) - 45v'93 + 39v'3I - 201 y'3 - 217
7r(9) =
~
In (J29 + 5)
v'58
y'2
(4.28)
(4.29)
(4.30)
Dario Castellanos is another 7r enthusiast, who in 1988 in an academic paper on "The Ubiquitous 7r" [41, p. 79] presented all kinds of
folklore and attractive approximations he had developed himself.
He started by transforming the Ramanujan approximation shown
at (4.18) into an even more attractive form:
7r(8) =
102 _ 2222
222
(4.31)
60
4. Approximations for
7r
He then tried something new. While continuing Ramanujan's procedure to the fifth power, he discovered
7r (8)
77729
254
(4.32)
and was surprised that Ramanujan had not come across this himself. In
addition, Castellanos also discovered these further approximations [41,
p. 79~80, 83]:
7r(6)
473 + 203
303
- 1
(4.33)
1+
(~~~) 2
(4.35)
21253
(4.34)
(4.36)
(4.37)
(4.38)
(689) / In (689)
396
396
or with
7r(8) = In (5280) /
vV
(4.39)
(4.40)
~<p2
(4.41 )
(4.42)
(4.43)
e(3) = V'20 + 1f
e(7) = \l1f 4
61
(4.44)
+ 1f5
(4.45)
These approximations can be transformed into even more impressive forms. Thus, the last approximation (4.45) becomes the attractive
and easy-to-remember expression
(4.46)
~ (~) n
)21fn
(4.47)
Stirling, 1730
The relative error is now less than 1% from n 2: 3 and less than 0.1 %
from n 2: 9.
For the similar case of the product of all the odd numbers < 2n,
F .L. Bauer [17, p. 49] used the following approximation:
(2n -I)! = (2n -1) (2n - 3) ... 31
J(2r0T
~1f.(n+!)
(4.49)
62
4. Approximations for
1t'
The 1[' approximations which Daniel Shanks derived from investigating complex quartic number fields are an order of magnitude better.
His piece de resistance is the following astonishingly simple formula
which produces 1[' to 80 decimal places [107, p. 398]:
With
D :=
~(1071 + 184V34)
(4.50)
E :=
~(1533 + 266V34)
(4.51)
(4.52)
1
C := '2(627 + 442V2)
(4.53)
followed by
d = D+ VD2 -1
(4.54)
e = E+ VE2 -1
(4.55)
F+ VF2 -1
(4.56)
9 = G+ VC2-1
(4.57)
we obtain
6
1['(80) = J35Q2ln(2' d . e . f . g)
(4.58)
In his article, Shanks proves the existence of an even better approximation of this type, which produces as many as 109 correct decimal
places for 1['. But due to the time that this would take he did not
calculate them. But, as he puts it, "It could be done."
Of course, a large number of good approximations for 1[' can be
obtained from terminating infinite 1[' series at an appropriate point. For
example, the Ramanujan series (1.9) shown on page 13, which yields
8 correct decimal places per term, produces an 80-digit approximation
of 1[' if it is terminated after the 10th term.
This method might appear somewhat trivial. On the other hand, an
infinite series which almost produces 1[' and thus converges close to 1['
would not be at all trivial. However many terms one were to calculate
in such a series, their sum would never come to 1['.
In fact there are some such series and they are truly amazing. Of the
two series shown below, the first one produces 1[' to over 18,000 decimal
places and the second one to as many as 42 billion.
In 10
71'(18,000) = 1002
+00
n~oo
1
10(n/100)2 )
63
(4.59)
(4.60)
J. and P. Borwein, 1992 [34J
These series thus converge to numbers which - even theoretically do not equal 71' but which "happen to" agree with 71' in the first 18,000
or 42 billion decimal places, as the case may be.
The Borwein brothers derived these formulae from so-called modular identities, and in fact the path from there to the formulae is surprisingly short [34]. When one considers that they evolved by chance
rather than being derived from the underlying theory they are quite
remarkable and could only too easily deceive one into thinking that
here indeed was the answer to the question of life, the universe and
71'. The Borweins in fact regard the series as an example of "caveat
computat" .
Incidentally, these formulae can be turned into any number of better
approximations for 71' by replacing the values 100 or 10 10 in them with
larger powers of 10.
Unfortunately, the series are not suitable for real calculations of
71'. It is true that they can be easily transformed from the range
-00 ... +00 to the range O... +00, and the terms in the first series
are derived from simple decimal shifts. However, one needs the value
In 10 in the first formula, and this is even more time-consuming to
calculate than 71' itself, and in the second series one would need to
calculate around 30 billion places of eX.
64
4. Approximations for
7r
2UE3
UU3
= -VT2=+=v'~=2=+=v'2=;;2
(4.61)
where UUn and UEn refer to the perimeters of circumscribed and inscribed polygons with 2n+1 sides. Kabus then made the numerically
interesting observation that the perimeters of the circumscribed polygons were always twice as far from the circumference of the circle as
those of the inscribed 2n-sided polygons. He proved
~UUn 11m
1
7r
2UEn
n-+oo 7r -
(4.62)
From the two observations, Kabus then derived the following iterative
algorithm for 7r:
(alg 4.63)
Initialise:
ao
:=
J~ + ~v'2
J~ + ~an
Then:
_
PK
2K+2 .J2-2<iK+y'2-2aK+l
-3y'2+2aK+l
----+
7r
65
who presented them in 1748 in his Introductio in analysin infinitorum [52, pages 303 fl1. The classic textbook on this interesting topic
was written by Oskar Perron [90], and a more recent textbook is that
by C. D. Olds [87].
A continued fraction is a fraction whose numerator is an integer
and whose denominator is the sum of an integer and a fraction which
in turn possesses the same form.
(4.64)
(4.65)
all
a21
a31
+ ~ + ~ + jb; + ... +
ani
Ibn
(4.66)
A. Pringsheim, 1898
(4.67)
Regular (Perron) or simple (Olds) continued fractions [90][87] are
ones in which all the numerators ai
1. They can be written even
more concisely like this:
(4.68)
The elements ai and bi of a continued fraction are also known, respectively, as "partial numerator" and "partial denominator" .
Every real number can be represented uniquely by a simple continued fraction. A number is rational if its continued fraction is finite
and irrational if its continued fraction is infinite.
The second theorem immediately proves, for example, that all the
numbers contained in the following list are irrational because their
continued fractions are infinite. The proof of the irrationality of 7r
which Johann Heinrich Lambert wrote in 1766 is also based on this
theorem. Lambert showed that the continued fraction of arctan 1 =
66
7r
4. Approximations for
7r
hence
7r
page 192).
The transformation of a number from its decimal representation
into its simple continued fraction form, and vice versa, is quite simple.
It can be performed with any pocket calculator which has an inverse
operation l/x. The two algorithms look like this:
II cf[] : array with the elements of the continued fraction
procedure NumberToCf (number , n, cf[O .. n-l])
{
x
:= floor(number)
cf [k] := x
number:= 1/(number-x)
}
and the reverse procedure for calculating a number from the elements
of its simple continued fraction goes like this:
function CfToNumber(n, cf[O .. n-1])
{
number := cf[n-1]
for k:=n-2 to 0 step -1
{
return number
}
v's+1
2
(Golden ratIO)
(4.69)
= 1.61803398874989484820 ...
= [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, ...J
V2 = 1.41421356237309504880 ...
= [1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, ..
(4.70)
(4.71)
---3
As this book is concerned almost exclusively with numbers that are transcendental and, as a very minimum, are irrational, we are naturally only interested
in infinite continued fractions.
e = 2.71828182845904523536 . . .
67
(4.72)
= [2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14,1, ... J
Euler, 1737
e2 = 7.38905609893065022723 ...
(4.73)
= [7,2,1,1,3,18,5,1,1,6,30,8,1,1,9,42,11,1,1,12,54, ..
(4.74)
Sundman, 1895
=
7r
[1,1,1,1,5,1,1,9,1,1,13,1,1,17,1,1,21,1,1,25,1,1, ... J
= 3.14159265358979323846
...
(4.75)
= [3,7,15,1,292,1,1,1,2,1,3,1,14,2,1,1,2,2,2,2,1,84, ... J
(4.76)
[1,1,3,2,1,1,6,1,28,13,1,1,2,18,1,1,1,83,1,4, ... J
= 22.45915771836104547343
...
(4.77)
= [22,2,5,1,1,1,1,1,3,2,1,1,3,9,15,25,1,1,5,4,1, ... J
~ = 1.25992104989487316476 ...
(4.78)
[1,3,1,5,1,1,4,1,1,8,1,14,1,10,2,1,4,12,2,3,2,1, ... J
n
, = n--+oo~
lim" -k
-In(n + 1)
(Euler's constant)
(4.79)
k=l
= 0.57721566490153286060 ...
= [0,1,1,2,1,2,1,4,3,13,5,1,1,8,1,2,4,1,1,40,1,11,3, ... J
Euler, 1734
68
4. Approximations for
7r
ratio" ( = 1 + /5/2), also to a few well-known transcendental numbers, such as the constant e itself and individual algebraic expressions
containing e, e 2 or e 1 / q , where q is an integer.
Interestingly, in almost all irrational or transcendental numbers,
including 7f, the geometric mean of their first n continued fraction
elements converges towards a fixed limit and this limit is the same
in all such numbers. This astonishing discovery was made in 1935 by
Alexander Khintchine (1894-1959) [74]:
lim \/b 1 b2
n--+oo
..... bn
= 2.6854520010 ... = Ko
(4.80)
nr=l
5. Arcus Tangens
7f
4"
= arctan 1
(5.1 )
The arctan function possesses a series which is relatively easy to calculate and was originally discovered by James Gregory (1638?~1675).
For the area under the curve y =
in the interval [0, xl he found:
1;x2
arctan x = {X
io
1 +t
From this he derived the Gregory Series in 1671:
(5.2)
70
5. Arcus Tangens
x3
arctan x = x - -3
(5.3)
Gregory, 1671
To obtain a formula for 7r with this series (5.3), one needs only to set
x = 1 because, as mentioned, arctan 1 = i. The resulting series is
called the Leibniz series:
111
7r
-=1--+---+--
4
3
5
7
9
(5.4)
Leibniz, 1674
No doubt due to its simplicity, "every schoolboy" knows the Leibniz series. However, it is not suitable for numerical calculations of 7r
because its terms get smaller only very slowly. If one terminates the
series after the nth term, the absolute error, i.e. the difference between
the series sum and the true value of 7r, is only ~ l/n. Therefore, for
example, even if one were to calculate 2 billion terms, one would only
obtain 9 accurate decimal places of 7r.
The poor convergence of the Leibniz series (5.4) is thus due to the
fact that it attempts to do too much in one go, so to speak. It determines 7r / 4 by calculating a single arctan, i.e. a single arc. If instead
one assembles 7r / 4 in a suitable fashion from relatively short circular
arcs, i.e. out of several arctan values, one arrives at formulae which
enable 7r to be calculated significantly more quickly.
The simplest of such compound arctan formulae dates back to Leonhard Euler (1707-1783), and goes like this:
7r
4' =
1
1
arctan 2 + arctan 3
(5.5)
Euler, 1738
+ fJf.I)
tana + tan (3
1 - tan a tan (3
(5 6)
.
if one makes the substitutions tan a = 1/2, i.e. a = arctan 1/2 and
tan (3 = 1/3 i.e. (3 = arctan 1/3.
The following diagram provides a geometric interpretation of this
formula:
71
B
arctan!
arctan
tan .!3
i. If we introduce
72
5. Arcus Tangens
tan4a
i_ _-_tan
_2
tanf3 = _
1 + tan4a tan i
1
239
(5.10)
(5.11)
f3 = arctan 239
239 - 3 . 2393 + 5 . 2395 - ...
a and f3 together produce
7r
- = 4a -
f3
(5.12)
= 4 arctan 5" -
1
arctan 239
(5.13)
= 4 [ 5"1 -
+ 5 .155
(5.14)
1
3 . 53
]
[1
1
]
- . .. - 239 - 3 . 239 3 + ...
Machin, 1706
This is the so-called Machin formula. It bears the name of the person
who discovered it, John Machin (1680-1752). He used it in 1706 to
calculate 7r to 100 decimal places.
The successive terms of the series of the first summand in the
Machin formula decline by around 1/25. The series therefore converges
with log1025 = 1.39 ... decimal places per series term. Due to the 5 in
the denominator, it can also be calculated relatively easily using paper
and pencil. The series of the second summand is more troublesome due
to the "awkward" 239, but on the other hand it converges better, with
around 4.76 places (= loglO(239 2 )) per term.
+ arctan
(a b
b )
-a +1
2
and
(5.15)
1 1 1
arctan - = 2 arctan -2 - arctan 4 3
(5.16)
a
a
a + 3a
with appropriate choices for a and b. Substitution of a = 2 and b = 1
produces the above-mentioned arctan formula of Euler (5.5), while
this formula plus substitution a = 3 and b = 1 results in the arctan
formula (5.17) of Charles Hutton (1737-1823) shown below. Using this
and other methods, over the years various further arctan formulae have
73
been discovered for the result 7r / 4, especially ones in which more than
two arctan expressions occur. Here is a selection:
7r
1
1
"4 = 2 arctan 2 + arctan "7
(5.17)
Hutton, 1776, Performance Index=3.28
= 3 arctan
(5.18)
= 6 arctan
(5.19)
= 4 arctan
5' -
1
arctan 239
(5.20)
1
1
1
- arctan - 4 arctan 10
239
515
(5.21)
= 8 arctan -
= 12 arctan 18 + 8 arctan 57
(5.22)
- 5 arctan 239
1 1 1
+ 2 arctan 443 - 5 arctan 1393 -
= 22 arctan 28
1
- 10 arctan 11018
(5.23)
Escott, PI=1.63
= 44 arctan 57
+ 7 arctan 239
1
+ 24 arctan 12943
1
- 12 arctan 682
+
(5.24)
This list contains some of the arctan formulae whose originators are
known. There are many other such formulae, some of whose originators
are known and others not. On our CD-ROM you will find a substantial
collection of them in the ari th directory, including some "monsters"
with 11, 12 or even 13 terms, also an algorithm which can be used to
automatically discover still more.
Along with the names of the originators, the list provides a "performance index" (PI). The smaller this is, the better, as this means that
calculation of 7r requires less effort. The performance index is based on
calculation of the expression 1/ log a 1 + 1/ log a2 + ... + 1/ log an.
From the list it is clear that the Machin formula is one of the best.
It is also the best of the four possible [32, p. 345] arctan formulae which
74
5. Arcus Tangens
comprise only two terms. This explains why for over 250 years it was
the favourite formula of 7r digit hunters.
Nevertheless, other arctan formulae were also widely used for a long
time. For example, Leonhard Euler in 1755 used the following relation:
7r
(5.25)
Euler, PI=1.89
Its performance index of 1.89 is worse than the formulae cited above.
But Euler discovered an elegant way to reduce the the amount of work.
He derived the identity
y(
)
2
2.4
2.4.6 3
arctan x = - 1 + -y + --y 2 +
y + ...
x
3
35
357
where y = x 2 /(1 + x 2 ).
(5.26)
Euler, 1755
and inserted the arguments of (5.25) into it. The first one, x = ~,
leads to y = l~O' while the second one, x =
produces y =
The powers of 10 which are now in these y's reduce their decimal
computation to a matter of simple decimal shifts. By this means Euler
was able to calculate 20 decimal places of 7r in less than an hour [32,
p.340].
t9
IM60'
24
and
1
(1
arctan 57 = 57 3250
24
(5.27)
(5.28)
75
2n+l
and
- =
3V5-5 - ~
~F2narctan
2
n=l
(2)
3F 2n+2
+ F 2n+2
(5.31)
Arndt, 1994
76
5. Arcus Tangens
6. Spigot Algorithms
78
6. Spigot Algorithms
(6.2)
Now compare this expression with the right-hand side of the 7r series
(6.1). You will see the same arrangement of brackets and also the
different bases. On the other hand, in the 7r series all the numerals
are equal, i.e. = 2, whereas in the week example they are different,
i.e. = 2, 3, 4 and 5; the Jr series is also infinite, whereas the example
terminates after the fourth digit.
Back to Jr. The task which the spigot algorithm performs consists
simply of converting the Jr series (6.1) to our base 10 number system,
i.e. to this form:
111
1
Jr = 3.1415 ... = 3 + 10 (1 + 10 (4 + 10 (1 + 10 (5 + ... ))))
(6.3)
79
Such a task is known in arithmetic as radix conversion and functions - in the present case - as follows:
On every step one 7r decimal place is calculated. To do this, first of
all all the digits in the number to be converted are multiplied by 10
(the new base). Then, starting from the right, every decimal place is
divided by the previous base (2i + 1)/i which applies to this decimal
place. On every division, the remainder is retained and the integer
quotient is carried over to the next decimal place. The most recently
calculated carry-over is the new decimal place of 7r.
The question arises as to how many terms in the 7r series (6.1)
really have to be carried over in order to obtain n decimal places
of 7r, including the digit 3 before the decimal point. In their article,
Rabinowitz and Wagon specify the value LI0n/3j, where the notation
lxj in the customary manner refers to the largest integer ~ x, i.e. it
means l10/3j = 3 and L3j = 3. They even "prove" that this value is
"correct". Unfortunately, it is not correct, as they could have seen from
the values n = 1 and n = 32. We are taking the liberty of correcting
the mistake and take one more decimal place, i.e. l10n/3 + Ij decimal
places, in the (tested) supposition that we are then correct in every
case.
Before we can begin to programme, we must explain the single real
complication in the algorithm.
When the base of the 7r series (6.1) is changed, it is possible for
a digit pair = 10 to occur. It can thus happen that at some point
a 10 occurs at position p, i.e. 3.1415 ... (p)(10). The 1 in the 10 is
an unresolved carry-over and must be added to the previous digit i.e.
3.1415 ... (p + 1)0. It can even happen that in front of such a 10 one
or more 9s have been calculated, so that those places too must be
corrected. The 3.1415 ... (p)99 . .. 9(10) must then be transformed into
3.1415 ... (p + 1)00 ... 00.
This complication means that the 7r program cannot release the
digits it has calculated immediately, but must store them in a buffer
until the next digit or the next few digits has/have been calculated.
When a new digit arrives, one or more digits will still be held in the
buffer. The first of these will definitely be < 9 and the others, if there
are any, exactly = 9. In this way we have the following situation in the
buffer at the point when the new digit q arrives:
p99 ... 9 +--- q
"-v-"
80
6. Spigot Algorithms
81
* function
*
void spigot(digits)
* Spigot program for pi
* 1 digit per loop
*1
#include <stdio.h>
#include <stdlib.h>
void spigot(int digits)
{
int
int
i, nines = 0;
q,
p = -1;
len = 10*digits+3+1;
*a;
int
int
a = malloc(len*sizeof(*a));
for (i=O; i < len; ++i)
a[i) = 2;
while (digits >= 0)
q = 0;
for(i=len; --i >= 1;
{
q += 10L * a[i);
a[i) = q % (i+i+1);
1*
1*
1*
1*
*1
82
6. Spigot Algorithms
q /= (i+i+1);
q *= i;
/* carry := iJoor(q,2i+1)*i
q += 10L * a[O];
a[O] = q % 10;
q /= 10;
/*
/*
/*
/*
first digit
q := carry + 10 * a[O]
a[O] = q mod 10
q : next prelim digit
i f (q == 9)
++nines;
else
{
/* q == 9: increment no of 9's
1* q
i f (p >= 0)
printf("%Olld", p + q/10);
/* p : prevo prel. digit
if (digits < nines)
/* adjust digits to print
nines = digits;
digits -= (nines+1);
while (--nines >= 0)
/* print 9's or O's
printf(q == 10? "0"
"9");
nines = 0;
p = (q == 10 ? 0 : q);
/* set previous prelim. digit
*/
*/
*/
*/
}
}
free(a);
return;
}
83
This trick not only has the effect that the entire program becomes
4 times faster, but an even more important effect is that the "complication" mentioned above becomes a lot simpler. The faster variant
always waits only exactly 1 position (consisting of 4 digits) instead
of having a variable number of places. This is sufficient for the first
approx. 50,000 digits of 7f, as up to that point there is no case in which
more than one such 4-digit chain has to be placed in a buffer. This is
only necessary if 4 zeros occur one after the other in a position that
is divisible by 4, and the first time that this occurs in 7f is at digit
position 54,936.
The second improvement is really a textbook tip which, however,
was evidently forgotten in the original formulation of the spigot algorithm. Namely, with a radix conversion, after each result place, one can
shorten the remainder that still has to be converted, by the number of
bits of the result place. Hence after each calculation of one place consisting of 4 decimal digits, the length of the f [] field can be reduced
by L104/3 + 1J = 14 places. This improvement speeds up the program
by an additional factor of 2.
Here is a C program for the faster variant. It is an expanded version
of the mini-program shown on page 37.
/*
* Spigot program for pi to NDIGITS decimals
* 4 digits per loop
* Expanded version
* Thanks to Dik T. Winter and Achim Flammenkamp.
*/
#include <stdio.h>
#include <stdlib.h>
#define NDIGITS 15000
#define LEN
(NDIGITS/4+1) *14
long
long
long
long
long
long
long
long
1* array of 4 digit-decimals*1
1* nominator prevo base
*/
a[LEN];
b;
c = LEN;
d;
e = 0;
f = 10000;
g;
h = 0;
/* index
/* accumulator and carry
/* save prevo 4 digits
1* new base, 4 dec. digits
1* denom prevo base
1* init switch
*/
*/
*/
*/
*/
*1
*1
*/
int main(void)
{
*/
84
6. Spigot Algorithms
*=
if (h
b;
==
0)
d += 2000
else
d += a[b]
g=b+b-1;
a[b]
d
= d % g;
1= g;
*1
f;
*1
f;
*1
*1
1* save carry
*1
h = printf(I%04ld", e+d/f);
1* print prev 4 digits *1
d = e = d % f;
1* save current 4 digits *1
1* assure a small enough d *1
}
return 0;
}
On the basis of the NDIGITS definition, this program calculates exactly 15,000 decimal places of 1r. There is no reason why it has to
stop at this limit if one is not concerned about the portability of the
program and compliance with ANSI C. As most C compilers around
ignore an overflow in the evaluation of integer expressions which depend on plus and minus signs and there is sufficient "breathing space"
in the array length, this program can normally be expanded to calculate twice as many 7r positions (using #define NDIGITS 32500). This
number was still a world record 40 years ago. Even more decimal places
can be calculated with floating point variables and arithmetic.
But however large a data range you select, even with this variant of
the spigot algorithm, i.e. where each place consists of only 4 7r digits
and only one such place is held in the buffer, it is still not possible to
get past 7r digit position 54932. This can only be achieved by removing
at least one of these limiting conditions; the easiest one to remove is
the first.
111
e = 1 + -(1 + -(1 + -(1 + ... )))
(6.5)
1
2
3
Here, as in the 7r series, different bases occur, but this time they
are all of the type that their numerator = 1. This means that when
85
Back on page 36 we promised to tell you how Lievaart's "obfuscated" program works. Well, it too works with the spigot algorithm
for e.
7. Gauss and
7r
One of the fastest method of calculating 7r, if not the fastest of all, is
almost 200 years old. It was invented by the German mathematician
Carl Friedrich Gauss (1777~ 1855) around 1800. It was subsequently
forgotten and only unearthed 170 years later, when two researchers,
Eugene Salamin [100] and Richard Brent [37] independently rediscovered it at the same time and turned it into the basis for superfast 7r
calculations.
Gauss's calculation method has since formed the basis of a number
of other formulations, as one can tell from the different names by which
the method is known in the literature. Thus we find the "Brent-Salamin
iteration" or the "Gauss-Legendre method" and other variations. In
this book, we refer to the method as the Gauss AGM algorithm as it
bears Gauss's unmistakable hallmark and its distinctive feature is the
arithmetic geometric mean (AGM).
7.1 The
7r
AG M formula
= 1
",",00
2k 2
"2 - uk=l
Ck
(7.1)
88
7. Gauss and
7r
be used, for example, to arrive at the average of two marks in a certificate of academic achievement. The geometric mean ..;a:b is also
well-known and is used to calculate the average of two or more variables which are linked by a multiplication operation, for example to
calculate the average of two interest rates. In both cases, the word
"mean" refers to a variable which lies "in the middle" between two
starting values.
The AGM is also the average of two variables a and b. However,
this average cannot be calculated in one step, but requires an infinite
number of steps, each of which approximates it more closely. The AGM
calculation rule is "iterative", in that each step builds on and improves
on the results of the previous step.
(alg 7.2)
Initialise:
ao := a
bo := b
Iterate: (k = 0,1,2, ... )
.- ak+bk
~
~
AGM(a,b)
AGM(a,b)
bk+ 1 := va:;;:1ik
Then converge ak and bk to the same limit AGM(a, b).
a k+l
.-
It can be seen that the ak+ 1 is calculated by taking the arithmetic mean
of its predecessors ak and bk, and the bk+l by taking their geometric
mean.
When Gauss first got interested in the AGM (at the age of 14) he
ascertained its numeric behaviour in a number of cases "manually".
One of four surviving numeric examples begins with the starting values
a = J2 and b = 1 and, applying the rule (alg 7.2), it proceeds as
follows: [56, III, p. 364]1.
Arithmetic mean
Geometric mean
a = 1.414213562373095048802 b = 1.000000000000000000000
al = 1.207106781186547524401 bl = 1.18920711500272106671 7
a2 = 1.198156948094634295559 b2 = 1.198123521493120122607
a3 = 1.198140234793877209083 b3 = 1.198140234677307205798
a4 = 1.198140234735592207441 b4 = 1.198140234735592207439
1
Accurate
places
0
0
4
9
19
7.1 The
7r
AGM formula
89
The AGM always lies between the geometric mean and the arithmetic mean of the starting values.
arithmetic mean It x
arithmetic-geometric mean AGM(l, x)
geometrc mean ..;x
1
x
The main point to emerge from this numeric example of Gauss's is
that ak and bk rapidly converge towards each other. The last column
shows the number of decimal places which are identical for both variables. After only four iterations AGM( V2, 1) is already accurate to 19
decimal places.
In each iteration, the number of correct decimal places approximately doubles. This quadratic convergence is the outstanding quality
of the AGM and is what makes it so interesting to mathematicians. In
our 7r formula (7.1) the speed at which 7r is calculated is determined by
the AGM function (in the numerator) effectively "bequeathing" this
quadratic convergence to it.
The denominator offormula (7.1) contains the variable Ck. This is a
useful auxiliary variable which crops up again and again in the context
of the AGM. The variables ak and bk are generated during the AGM
iterations. The auxiliary variable Ck is defined as half the difference
between them.
90
7. Gauss and
71'
(7.3)
c~+1
a~+1 - b~+l
(ak+1 - ak)2
(7.4)
ao and bo, 0 < bo ::; ao and the auxiliary variable Ck+l := (ak - bk)/2, the following
apply [32, p. 1-4]:
ak
bk
Ck
ak+l + Ck+l
ak+l - Ck+l
(ak - bk)/2 = cLd(4ak)
=
=
c~ = a~ - b~ = (ak - ak-d
o ::;
AGM(A . a, A . b)
= A' AGM(a, b)
a+b
r-;-
AGM(a,b)
= AGM(-2-,vab)
AGM(l b)
,
Also:
1 + b AGM(l 2Vb)
2
' 1+b
91
(alg 7.5)
Initialise:
ao
:= 1
bo := 1/V2
80 := 1/2
Iterate (k = 0,1,2, ... , K - 1)
t := ak
ak+1 := (ak + bk ) /2
bk+l := v'tbk
Ck+l := (ak+l - t)2
8k+1 := 8k - 2k+lck+l
Compute an approximation of 1f:
1fK
(aK+b K )2
2s K
1f.
These few lines thus define one of the best algorithms for calculating
The first three iterations alone produce 19 accurate decimal places:
7. Gauss and
92
Iteration
1
2
3
4
5
6
7
8
9
7r
PK
3.14 ...
3.14159 26 ...
3.14159 26535 89793 238 ...
ditto
ditto
ditto
ditto
ditto
ditto
J\ccurate places
3
8
19
41
84
171
345
694
1392
<
PK+1
7r -
7r -
- J\GM2(1,
1/V2)
(7r-PK?
2K+17r 2
or
(7.6)
The quadratic decrease in the absolute error (7r - PK) will be evident
from the second expression, and from this one can determine that PK
is always smaller than 7r.
93
(alg 7.7)
Initialise:
ao
:=
Ao := 1
Bo := 0.5
So := 0.5
Iterate: (k = 0,1,2, ... , K - 1)
t := (Ak + B k )/4
bk := VIJk
ak+l := (ak + bk)/2
A k+1 := a~+l
Bk+l := 2(Ak+l - t)
Sk+l := Sk + 2k+1 (Bk+l - Ak+I)
Compute the approximation of 7r:
_ AK+BK
PK SK
Schonhage dispenses with the long multiplication of akbk by replacing that product with less time-consuming operations involving other
variables which occur: akbk = 2(a~+1 - i(a~ + b~)). (The squares of a
and b are stored in the variables A and B.) The resulting performance
is around 25% better. This is achieved without any implementation
tricks simply through rearrangement of the operations.
In this way Schonhage avoids another long square root calculation
during initialisation and, during the calculation of the approximation
for 7r, he avoids a long squaring operation.
If one takes advantage of the fact that the bk and Bk can share the
same memory store, then the Schonhage arrangement, like the original
form, requires only 5 long variables, namely a, A, b = B, t and s, thus
avoiding any storage penalty for the speed gained.
It is very easy to convert the Gauss AGM algorithm to a program,
using the Schonhage variation:
a =A=1
B = s = 0.5
II B and b can share storage
for k=1 to N
t = (A+B)/4
b = sqrt(B)
a = (a+b)/2
A = a-2
B = (A-t)*2
s = s + (B-A) * 2-k
end for
pi = (a+b)-2/(2*s)
94
7. Gauss and
7r
For the first few digits of 1f this program can be implemented without any problems in a standard programming language with normal
floating point arithmetic or, better still, with a computer algebra system. Calculation of world record numbers of decimal digits is not,
however, so easy and major implementation problems arise.
95
AGM is actually older than the AGM itself [46]. The French mathematician Joseph-Louis Lagrange (1736~ 1813) was the first to use the
rule (alg 7.2) in 1785 for the calculation of approximations for elliptic
integrals, although he did not discover the AGM or its relationship
with elliptic integrals himself. It was Gauss who succeeded in making
these discoveries. As David Cox writes, "... we have the amusing situation of Gauss, who anticipated so much in Abel, Jacobi and others,
himself anticipated by Lagrange." [45, p. 315].
It was in 1791, at the tender age of 14, that Gauss discovered the
AGM. His discovery exercised such a fascination on him that during
the next 10 years he worked almost without interruption on developing
an AGM theory and took this work to heights which have not been
surpassed since [57, p. 186].
Then when he was 22 or 23, Gauss wrote an essay (in Latin) on his
discoveries relating to the AGM: de origine proprietatibusque generalibus numerorum arithmetico-geometricorum (On the origin and general characteristics of arithmetic-geometric means) [56, III,pp. 361 ~
374]. However, he never had the essay published and it was only printed
in 1866 as part of his estate. Gauss's lifetime publications included
only one piece on the AGM, and that was in 1818 in his treatise Determinatio attractionis (On the attraction of the elliptic ring) [56, III,
p. 352~353], which contains the third proof of the fundamental identity
(7.13). Additional information is provided in his formal writings.
Very little is known about Gauss's teenage research on the AGM.
However, it seems likely that he possessed the basic knowledge quoted
above very early, and evidently he knew from his research on the lemniscate that special significance is attached to the argument pair V2
and 1. There are also signs that already in 1794 he was aware of the
connection between the AGM and "numerical integrals", as he called
them, which today are referred to as theta functions 2 .
There were two phases to Gauss's research on the AGM, 13 May
1799 marking the start of the second phase. It was on this that Gauss,
now 22 years old, succeeded in forging a link between the AGM and
a quite different area which up to then he had been following quite
separately.
Theta functions are power series whose exponents are square roots.
96
7. Gauss and
'IT
The lemniscate
The second constituent in Gauss's 7r formula (7.1) besides the AGM
is the so-called lemniscate function. This function take its name from
the lemniscate 3 , a curve which Gauss had already studied in detail as
a teenager. The lemniscate takes its name from the Greek word lemniskos, meaning a little ribbon or bow. It looks rather like a sideways
8:
~A
Expressed in polar co-ordinates, its equation is as follows:
r2
cos 2()
(7.8)
When Gauss turned to the lemniscate, this curve was almost exactly 100 years old. Two brothers had discovered it independently in
the same year, 1694, Jakob Bernoulli (1654-1705) and his younger
brother Johann (1667-1748). Jakob's publication about it appeared in
September 1694 and Johann's only a month later. Following publication, the brothers had a violent dispute about which of them could
claim to have invented it [45, p. 311]. The quarrel went so far that
Johann swore he would never return to Basle as long as his brother
was still living4.
Jakob Bernoulli had discovered the lemniscate via the so-called elastic curve, and still expressed it in Cartesian co-ordinates (xx + yy =
aJ xx - yy). This elastic curve is formed if one forces a rod to bend
so far that its ends are perpendicular to an imaginary line connecting
their endpoints.
The lemniscate is the set of all the points for which~roduct of the distances
of two fixed points Hand F2 possesses the value (HH/2)2.
When Jakob died in 1705, Johann succeeded him to his professorship in Basle,
which post he held for another 43 years [83, p. 112].
~-n
97
o~-----------+
-_.LJB
y-
lo
z2 dz
(7.9)
Vl- z4
More important historically than the equation for the curve, however, was the equation for its arc length AGB. This goes like this:
lo
dz
(7.10)
2.6220575542 ...
o Vf=Z4
Jakob Bernoulli succeeded in writing a formula for this arc length
in 1691. He needed it again three years later when he was looking for
a curve that was analytically more manageable but had to have the
same arc length. He found this curve in 1694 in the lemniscate, whose
half perimeter is in fact given by the integral (7.10). Thus one can say
that the arc length of the lemniscate was known before the lemniscate
itself [45, p. 311].
In the eighteenth century, even before Gauss, the elastic curve and
the lemniscate figured in many mathematical treatises. For example, in
1730 James Stirling (1692-1770) specified approximate values for the
integrals (7.9) on the interval [0,1] and for (7.10), which were accurate
to 17 places. Giovanni Fagnano (1715-1797) discovered some methods
for dividing up the lemniscate arc into n equal parts, where n can be
equal to 2m , 3 2m or 5 2m [45, p. 313].
From 1748 Leonhard Euler (1707-1783) developed a first stage of
the theory of elliptic integrals, starting from the lemniscate. In particular, Euler discovered the remarkable relationship between the two
integrals already cited:
1
1
dz
z 2dz
w=2
Jo
VI - z4 . Jo VI - z4
(7.11)
98
7. Gauss and
7r
Gauss began work on the lemniscate in January 1797 (at the age
of 19), as is borne out by entry no. 51 in his mathematical diary [55,
p. 67]: "Curvam lemniscatam a
dx
Jl-x4
7r /2
= 1\1 - z2)-1/2 dz
(7.12)
The analogy is visually even greater when one reflects that in Gauss's
day the symbol n was often still used in lieu of the symbol w.
In 1798 Gauss began to study the expression ~, which turned out
to be the key to further discoveries. Amongst other things he found a
series for the inverse of this expression, and with it he calculated w / 7r
to 15 decimal places.
Suffice to say that by July 1798 Gauss already knew "everything"
about the quotient 7r/w [45, p. 319]. Entry no. 92 of his diary states,
5
Henrik Abel (1802-1829) subsequently continued Gauss's work and found that
exactly the same ratios apply to the lemniscate as to the circle and, in particular,
that division of the lemniscate into 17 parts is possible with compass and straight
edge too.
99
"We have gained some very elegant details about the lemniscate, which
have exceeded all expectations, and indeed using methods which open
up an entirely new field." He sensed that he had made an important
discovery and under no. 95 (in October 1798) he even wrote, "A new
field of analysis stands before us, namely the investigation of functions
etc." Gauss was so excited that he left his sentence unfinished.
~ = AGM( V2, 1)
(= 1.19814 ... )
(7.13)
w
In this formula Gauss recognised the connection between two apparently non-overlapping areas, namely the AGM and the lemniscate
functions, which in turn are closely related to the elliptic functions.
He was also aware at the time of the significance of his discovery as
his conclusion ("new field of analysis") suggests. This conclusion was
fully confirmed, moreover, in the 19th century by the work of Riemann,
Jacobi et al.
It is striking in the diary entry that Gauss had arrived at his findings not through mathematical deduction but through simple comparison of two numbers. Normally mathematicians are cautious about
inferring a law simply from numeric coincidence. But this was quite
different; Gauss seems to have suspected that this coincidence was no
chance occurrence. This was by no means the only instance in which
numeric results led Gauss to infer mathematical relationships, but it
was without a doubt the most prominent.
The wording in his diary also reveals that Gauss did not yet have
a proof, and this he developed only later. When exactly is not known,
but it is certain that by 23 December 1799 he actually had two proofs,
and in 1818 he even published a third.
The first and second proofs run over the comparison of the series
expansions of the left and right sides of (7.13). The third proof is the
shortest and the most elegant [56, III, pp. 352, 353]. Gauss examined
the complete elliptic integral of the first kind,
100
7. Gauss and
I (a, b) =
7r
r /2 -r===d=e===:::==
J a cos + b sin e
io
2 ()
of which the lemniscate perimeter is a special case: r:v = 2I( V2, 1). He
then showed that this integral remains constant if a and b are iterated in accordance with the AGM rule (alg 7.2): I(a, b) = I(al' bl ) =
I(a2' b2) = .... As ak and bk move towards the same limit value
AGM(a, b), I(a, b) = 7['/(2 AGM(a, b)) applies, which proves the relation (7.13).
It is only a few steps from this proof to the 7[' formula (7.1). In
modern accounts, for example as presented by Nick Lord [81], the path
from there takes one over the following steps which are not difficult and
were not new ground in Gauss's time. The missing pieces were, firstly,
the auxiliary integral L( a, b) = o7r /2 cos 2 ede / J a 2 cos 2 e + b2 sin2 e,
for which L(a, b) + L(b, a) = I(a, b) holds true; secondly, the relationship mentioned above that was discovered by Leonhard Euler(7.11) of L(V2, 1). I(V2, 1) = 7['/4; and, thirdly, the relationship
c6L(a, b) = (c6 - S)I(a, b) with S = L~o 2k-Ic~, which is obtained
from c6L(b, a)-2cI L(b l , al) = c6I(a, b)/2. If the argument pair (V2, 1)
is converted to the pair (1, 1/ V2), a more elegant version of the result
is obtained. And there you have the formula (7.1) and the Gauss AGM
algorithm.
The original
It took us a long while to uncover the original formula of Gauss which
forms the basis of the Gauss AGM algorithm. It appears on page 6 of
handbook 6, Short essays from various fields of mathematics, begun in
May 1809.
This little work is in the possession of the Niedersiichsische Staatsund Universitiitsbibliothek Gottingen (Lower Saxon State and University Library Gottingen) (shelf mark: Cod. Ms. C. Fr. Gauss, Handbuch
6). When we enquired after it, it turned out to be in a pitiful condition,
so that the manuscripts and rare books department first had to have
the book restored before we were able to print the formula (with their
blessing) for the first time as Gauss originally wrote it:
.'!tit ii..c1o!)
,I,
.. It "::.
1(t .. t'd
" =
I ..
(I
...
101
\f1i.6
y'"
~j ,t
tit. ~
+4( I#'l'.~. tt." )
\"'41.-
a.~-::.It
,....
elll + etc.
} _!
+C'C'+2C"C"+4CIII C III +etc. - 2 aa
e' e'
+ 2 e" e" + 4 e
lll
_ 2mM
7r
(7.14)
k=l
! _ 2(AGM(1, 1/V2))2
2
7r
(7.15)
102
7. Gauss and
7r
8. Ramanujan and
7r
104
8. Ramanujan and
1
27rV2
1103
99 2
71'
27493
1 1 3
+ 996 . 2 . 42 +
53883 1 3 1 3 . 5 . 7
99lO . 2 . 4' 42 . 82
+ ...
(8.1)
105
~
'IT
k=O
(2n)
42n + 5
n
3
212n+4
(8.2)
This series does not converge particularly well, producing only 1.8
decimal places per term. But it is possible with this series to calculate
the second half of n binary places of 1/'IT without having to calculate
the first half, because the denominators grow twice as quickly as the
numerators. In this respect, Ramanujan had discovered here what was
a kind of precursor to the BBP series discovered only quite recently
(see Chapter 10), which permits the calculation of binary places in the
"middle" of 'IT.
106
8. Ramanujan and
7r
107
108
8. Ramanujan and
7l"
There were also five notebooks and various unpublished essays and
manuscripts plus 120 theorems in his letters to Hardy.
A simple list of the topics on which Ramanujan worked reads as follows [25, p. 644J: partitions, theta functions, statistical mechanics, Lie
algebra, probability theory, modular forms, elliptic functions, complex
multiplication, hypergeometric series, q series, asymptotic behaviour,
beta integrals.
He also made some comparatively elementary discoveries. There
is an anecdote about a taxi with the registration number 1729. It
was in such a taxi that in around 1918 Hardy drove to a hospital to visit Ramanujan. On entering, Hardy mentioned this number,
upon which Ramanujan commented, "1729 is a very interesting number, it is the smallest number expressible as a sum of two cubes in
two different ways." Ramanujan was referring to the representations
13 + 123 = 93 + 103 , both of which produce 1729. In fact it is true
that no smaller number possesses this characteristic. Ramanujan also
discovered formulae for the construction of higher sums of powers and
used them, for example, to ascertain the identity
44
+ 64 + 84 + 94 + 144 =
15
(8.3)
J +.J5 _ .J5 +
5
_ _ _e_-_;-.,,----_ _
(8.4)
e- 2rr
1 + -------;--e- 4rr
1+
-6rr
1+_e_ _
1 + ...
V5+1
1+
~ (V5-1)~
2
54
2
1
271"VS
e--5-
- - - - = - - - - (8.5)
e- 2rrv5
1+-----=-e- 4rrv5
1+
e- 6rrv5
1+--1 + ...
----;:=-
109
Hardy said of these and other formulae containing continued fractions [63, p. 9]: "I had never seen anything in the least like them before.
A single look at them is enough to show that they could only be written down by a mathematician of the highest class. They [the formulae]
must be true because, if they were not true, no one would have had
the imagination to invent them."
Some of Ramanujan's findings have been lost, even though G.E. Andrews at least recovered Ramanujan's "missing notebook" in 1976.
Some of it the University of Madras may have succeeded in losing. At
any rate Mrs. Ramanujan said that shortly after her husband's death
his former teacher had come and claimed all his documents for the
university, but no one has succeeded in finding them there.
Ramanujan's Collected Papers appeared seven years after his death.
In 1936, Hardy gave "twelve lectures on subjects suggested by [Ramanujan's] life and work", which were published in 1940. In the foreword, Hardy writes as follows about his protege [63, p. 6]: "The real
tragedy about Ramanujan was not his early death. It is of course a
disaster that any great man should die young, but a mathematician
is often old at thirty, and his death may be less of a catastrophe than
it seems. Henrik Abel (1802-1829) died at twenty-six and, although
he would no doubt have added a great deal more to mathematics, he
could hardly have become a greater man. The tragedy of Ramanujan
was not that he died young, but that, during his five unfortunate years,
(between eighteen and twenty-three) - his genius was misdirected, sidetracked and to a certain extent distorted."
Several authors, including the Borwein brothers, have succeeded
in recent years in rendering Ramanujan's work much easier to understand and more transparent. A significant contribution here was made
(and is still being made) by Bruce Berndt, who is currently publishing Ramanujan's notebooks with a detailed commentary. Above all,
Berndt is adding in the missing proofs (and in some cases dis proofs )
which Ramanujan omitted to write down or else wrote only incompletely. Four of the five notebooks have already been published [24].
For friends of Jr, notebooks 3 and 4 are the most interesting.
110
8. Ramanujan and
7r
8.3 Impulses
The path which led Ramanujan to his discoveries about 7r has proved
to be of great practical importance and very forward-looking. Several
other researchers have continued down the same route.
The Borwein brothers have succeeded in deriving general formulae
which enable any number of convergent series of the Ramanujan type
to be generated (through fixing of one parameter). Further information
will be found on our CD-ROM in the ari th directory. Following this
model, one of the authors (JA) generated the following series which
produces a staggering 50 correct decimal places per term:
1
(6n )!
A +n B
In
00
;: = yCI2] ~
(8.6)
where
A := 5280419026080999965452185 +
+ 2361475178400070170568800 v'5 + 32 v'5 .
. (10891728551171178200467436212395209160385656017+
+4870929086578810225077338534541688721351255040 v'5) 1/2
B := 654159204458052267524145750 +
+ 292548889855077669080467200 v'5 +
+ 209664 )3110
. (6260208323789001636993322654444020882161+
+ 2799650273060444296577206890718825190235 v'5)
1/2
+ 108 v'5(10985234579463550323713318473 +
+ 4912746253692362754607395912 v'5) 1/2] 3
Arndt [7J, 1994
8.3 Impulses
~=
1f
12
~(_l)k (6k)! 13591409 + 545140134k
J640320 3
(k!)3(3k)!
(640320 3)k
f='o
111
(8.7)
It was with this series, which produces 15 decimal places per series
term, that the Chudnovskys calculated 1f to over 8 billion decimal
places in 1996. The series is used in several computer algebra systems,
e.g. in Mathematica, to calculate 1f, and is thus a very useful series; it
would also be the ideal candidate for anyone seeking to divide up the
task of calculating 1f on the Internet because it can be adapted very
well to the binsplit algorithm (see Chapter 15 on page 215ff.).
In the more recent high-performance calculations of 1f, Ramanujantype series have been replaced by other methods, notably by iterative
algorithms developed by the Borweins.
One of these is this "quintic" algorithm:
(alg 8.8)
Initialise:
So := 5(y5 - 2)
ao := 1/2
Iterate:
Sk+l
:= (25)/(Sk(Z
where
+ x/z + 1)2)
1
IT
7r
If anyone or two figures stand out from the 7r research of recent years,
then it must be Peter and Jonathan Borwein. They have developed
virtually all the high-performance algorithms on which 7r computations
are based today.
The brothers were born in St. Andrews, Scotland, Jonathan in 1951
and Peter in 1953. Their parents emigrated to Canada, where David
Borwein was for many years head of the mathematics institute at the
University of Western Ontario and is now a professor emeritus. It was
"natural" that the brothers should study mathematics, and Jonathan
obtained his PhD in 1974, Peter in 1979.
After completing their studies, they worked - together - at Dalhousie University in Halifax, the capital city of the east Canadian
province of Nova Scotia. There they both became professors as well.
Then in 1992 Jonathan moved from the east to the west of Canada, to
be followed a year later by Peter. Today they both teach and research
at the Simon Fraser University in Burnaby, British Columbia. There
they head the Center for Experimental & Constructive Mathematics
(CECM), which they have had a free hand at establishing.
The Borweins' academic work is already very considerable. Peter
Borwein's list of publications includes five books and almost 100 articles just over a period of 14 years. Jonathan Borwein has published a
similar volume of papers.
7r is not the only research field in which the Borweins are active.
In fact, less than 20% of their publications include 7r in the title. Nevertheless 7r is the main topic with which their names are currently
linked. The main reason for this is that since 1984 the brothers have
developed a large number of high-performance algorithms for the calculation of 7r which have been immediately implemented and executed
by various mathematicians, such as Bailey and Kanada. The Borweins
made their debut in the 7r field in 1984 with the following quadratically
114
7r
Algorithm (9.1)
7r
7r algorithm of
(alg 9.1)
Initialise:
ao
bo
:=
:=
Po :=
J2
0
2+ J2
~ (..fiik + k)
bk +1 .=
.
v~"
Iak (J!rll)
bk+ak
k +1 )
._ Pk bk+1 (1+a
2
Pk+1 .1+bk+ 1
--t
Then converge the Pk'S quadratically to
1
Pk - 7r < 10 2k+
(k ~ 2)
7r+
7r+, where:
But this algorithm was only the starting point for many other algorithms of the iterative type, including some which converge even better.
Among these, the following quartic algorithm made their names especially well known, as since its publication in 1987 it has been used in
most subsequent world record calculations, notably in those achieved
by Yasumasa Kanada [32, p. 170J:
(alg 9.2)
Initialise:
Yo :=
ao
J2-1
4J2
:= 6 -
o ak -
7r
115
116
7r
7r
1 (4
~ 16n
00
1)
8n + 1 - 8n + 4 - 8n + 5 - 8n + 6
(10.1)
118
With this series it thus becomes possible to calculate any hexadecimal place within 1f. Even better, the series enables the next digits from
any given hexadecimal place of 1f, for instance from the last known
digit, to be added piece by piece without having to calculate a single
prior position. The distinguishing term in the formula is the 16n in the
denominator of every series term.
We will shortly examine the mathematical procedure of the "BBP
series" (as it has since become known). But first let us consider the
question of how the formula came about.
Certainly not by chance, even if luck played some part in the discovery. All three parties are established mathematicians who have been
working with the number 1f for a considerable time. The mathematical
background against which the BBP series was developed has been thoroughly researched. Yet the series was not discovered through mathematical deduction or inference. Instead, the researchers used a tool
called Computer Algebra System and a particular procedure called the
"PSQL algorithm" to generate their series. They themselves write [10]
that they found their formula (10.1) "through a combination of inspired testing and extensive searching" .
Computer Algebra is a scientific area which is concerned with methods for the solution of mathematically formulated problems using symbolic algorithms. Its origin is sometimes attributed to Ada Augusta,
Countess of Lovelace l (1815-1852), who may have been the first person to remark that computers are also suited for handling symbolic
data (such as formulae). Computer Algebra Systems, of which the
best known are MuPAD, Maple or Mathematica, normally work with
mathematical symbols rather than with numbers. One of their use is
for checking the derivations of equations, but they are also used to
identify new relationships, as in the present context or to perform
high-precision calculations.
The PSQL algorithm is used to find integer relationships between
real numbers. A vector of real numbers (Xl, X2, . .. ,xn ) is entered. The
algorithm then looks for a vector of integers (aI, a2, ... , an), which do
not all = 0, such that the relation alxl + a2X2 + ... + anxn = holds
true. It is easy to see why this algorithm was a material factor in discovering the BBP series. The researchers had established that the classic
series for In 2 = L:~=l n.~n can be used to calculate any binary digits of In 2. They therefore wondered whether there might be a similar
119
series for 7r. After many failed attempts, they finally fed the PSQL al. h
'th
,\",00
1
,\",00
1
gont m WI Xl = 7r, X2 = un=l (8n+1)16n"'" X8 = un=l (8n+7)16 n '
When the algorithm then churned out the vector (1, -4,0,0,2,1,1,0),
the BBP series was discovered [5SJ.
In this way the series (10.1) was the brainchild not of a human but
a computer. Nevertheless, it still needs a normal proof, which is not
very difficult [13J.
First it is necessary to establish that for every k < S the following
is true:
1/../2
1
o
xk-1
- - -8 dx
1- x
11/../2
00
x k -1+8n dx
n=O
1
= 2k/2
00
n=O
(10.2)
+ k)
16 n (Sn
1 (4
2
1
1)
Sn + 1 - Sn + 4 - Sn + 5 - Sn + 6
~ 16n
00
11../2 4yi2 - sx 3
1o
4yi2x 4
I-x
Sx 5
dx
(10.3)
}0
16y -16
d
y4 - 2y3 + 4y - 4 Y
1
1
4y
11
4y - S
(10.4)
--dydY=7r
o y2 - 2
0 y2 - 2y + 2
where the fraction in the integral on the left has been partly reduced.
The BBP series could certainly also be used to calculate 7r from
scratch, but it is not particularly well suited for such a computation,
so it will never replace algorithms such as, for example, the Gauss
AGM algorithm, which have been known for longer. The strength of
the formula (10.1) clearly lies in its ability to calculate individual digits
"anywhere" in 7r. The computing plan for this is not at all difficult and
moreover it contains a special treat.
During evaluation of the BBP series, one calculates each of the four
summands 8 1 = I:~=o 16n(Jn+1) ' 8 2 , 83, 8 4 separately. Let us consider,
for the sake of example, 8 1 .
120
n=O
=~
~
n=O
16
d n
-
(10.5)
n=d
Here, reduction through the modulo function is used wherever appropriate, so that only the remainder of each division is considered. The
summand 81 is now represented by two part-sums. In the first of these,
the d - n's are positive so that the powers 16 d - n are in the nominator
and the series terms are > 1. In the second part-sum, on the other
hand, the d - n's are negative and all the series terms are < 1. The
reduction to remainders is only necessary and useful for the first partsum.
121
left). Then replace each "I" by the pair of letters SX, replace each
"0" by S, and cross off the "SX" that now appears at the left. The
result is a rule for computing x n , if S is interpreted as the operation of
squaring, and if X is interpreted as the operation of multiplying by x.
For example, if k = 23, its binary representation is 10111; so we
form the sequence SX S SX SX SX and remove the leading SX to
obtain the rule SSXSXSX. This rule states that we should "square,
square, multiply by x, square, multiply by x, square, and multiply by
x; in other words, we should successively compute x 2, x4, x 5, xlO, xu,
x 22 , x 23
According to Knuth this "binary exponentiation" was already
known in India over 2000 years ago. It is recorded in 200 BC in India
in a work called "Chandah-sutra" [77, p. 461]. Knuth notes that this
information was evidently confined to India and outside of India there
was still no mention of the method 1000 years later.
In the problem we are about to consider, a small modification
should be made. As we are only interested in the places after the
hexadecimal point and integer elements are negligible in the calculation, we only need to calculate the remainders of each division and can
forget the quotients. This makes all the numbers a lot smaller. Thus
on every iteration, a modulo operation is performed with the (next)
denominator c = 8n+ 1. The result is "binary modulo exponentiation" .
This can be easily translated into an algorithm:
122
(alg 10.6)
:=
t/2;
r := r2 mode
if(k?::t)
{
k:= k - t
r := b rmode
}
}
At the end of this calculation, r is given the desired value bk mod e.
The algorithm is executed entirely with positive integers which do
not become greater than (e - 1)2. A numeric example from [13] goes
as follows. During the calculation of 349 mod 400, r successively assumes the values 3, 9, 27, 329, 241, 81, 161 and 83, and in fact
349 = 239,299,329,230,617,529,590,083, so that 83 is the correct result.
Calculation of the rest of the formula (10.1) is very simple. The
summands calculated through binary modulo exponentiation have to
be divided by 8n+ 1 and added up. Once again we are only interested in
the portions which come after the hexadecimal point. The procedure is
then expanded to the summands 82 to 84. The sum 481 - 282 - 83 - 84
is then calculated, and its first place after the hexadecimal point is the
desired hexadecimal digit of 1r.
As you can see, the BBP series is surprisingly simple. Neither the
formula (10.1) nor its proof or implementation are particularly subtle or complicated. It is precisely this which makes the algorithm so
interesting.
Even if 7f is the main point of interest, as is so often the case,
especially in this book, it requires only a minor foreshortening of the
results of Bailey, Borwein and Plouffe to narrow it to 7f. In fact it goes
a lot further. The three researchers have not only found additional
formulae of the above type for 7f, 7f2 etc., but they have also discovered
such formulae for other "polylogarithmic" constants, such as log 2.
123
Their paper on the subject [10] presents these results in detail as well.
We recommend most strongly that any reader so inclined should look
at the article, which can be easily downloaded from the Internet.
http://www.cecm.sfu.ca/personal/pborwein
124
****************************************************** ****1
#include
#include
#include
#include
#include
<stdio.h>
<stdlib.h>
<math.h>
<time.h>
<float.h>
1* Limits:
d_max = p_max - 1
ak_max = 8 * d_max + 6
r_max = ak_max - 1
r_max-2 < 2-(LDBL_MANT_DIG).
With mantissa length = 2m (usually 2m
r_max <= 2-m-1
ak_max <= 2-m
d_max < 2-(m-3)
p_max < 2-(m-3)
*1
#define p_max
64):
pow(2, LDBL_MANT_DIG*0.5 - 3)
1***************************************************** *****
**
****************************************************** ****1
nt
= 2;
r = fmodl(r*r, ak);
if n & nt) != 0)
r = fmodl(16.0*r, ak);
nt = 1;
} while (nt != 0);
return r;
}
1***************************************************** *****
**
**
series(double m, long d)
computes sum_k {16-(d-k)mod(8k+m)}/(8k+m),
(k=O, 1, 2, ... , d-l)
****************************************************** ***1
double series(double m, long d)
{
long
k;
double ak = m;
double s = 0., t = 1., x;
s += x;
1= 16.0;
ak += 8.0;
return s;
}
1***************************************************** *****
*
main 0
*
******************************************************* ****1
main(int argc, char *argv[])
{
1* default fuer p *1
125
126
4, 8i+l */
1* -2, 8i+4 *1
1* -1, 8i+5 *1
1* -1, 8i+6 *1
>= 0 */
t_end=clockO;
printf("%08lX\n", (unsigned long) (s*pow(2, 32);
printf(HElapsed time was: %.1f sec.\nH,
1.0*(t_end-t_beg)/CLOCKS_PER_SEC);
return 0;
}
10.3 Refinements
Bailey, Borwein and Plouffe had hardly announced their "shocking
formula" (10.1) when other researchers sat down at their computers
and attempted to also find beautiful "BBP-like" series. In particular,
BBP formulae were found for other constants, for example, for 71"2 and
log 7, as well as simpler or more effective formulae for 71" itself (to view
some examples, see our collection of formulae on page 227).
The research duo Viktor Adamchik and Stan Wagon win the prize
for the simplest of all the BBP formulae for 71":
00
71"
(_l)n ( 2
=~~
4n
1)
+ 1 + 4n + 2 + 4n + 3
(10.7)
This formula consists of only 3 terms, i.e. one term fewer than the
original BBP series. But it is not only shorter.
Wagon and Adamchik have determined with this series [lJ that
there is a route to its derivation which simultaneously includes the
proof of the series. With (10.7) one no longer needs to convert the
summands found by the computer into integrals and then resolve them,
as shown above, but instead one can to a certain extent lean back
and leave the computer to manipulate identities. The authors needed
"only" one idea.
As such an idea, they used the expression:
10.3 Refinements
~ (-l)n ( a l
~-n
n=O
4n
a2
a3
a4
+ 1 + 4n + 2 +4n-+-3 +4n-+-4
127
They entered this into their computer algebra system Mathematica 3.0
which then produced the following transformed expression:
1
S(2( 4(a2 arccot 2 - a4log 4 + a4log 5 + a3( 7r /4 + arccot 3 - (log 25) /4) ))
At this point the authors told the computer to perform a few simple
substitutions, e.g. the substitution 7r = arctan 1 + arctan 2 + arctan 3,
following which it produced this still further simplified output:
2a2 + (a2l 7r
a2
+ a3 )
a3 + a4 )
- 2
log 5
This took care of the most irksome work. Wagon and Adamchik now
needed only to look for such values for aI, a2, ... a4, with which the
coefficients of the second to fourth terms become = 0, while the first
coefficient becomes = 1. This solution they would of course have also
been able to find in 10 seconds by hand, but they got the computer to
do this for them too, and for this purpose they entered
They could hear their computer deliberating, and then the system
delivered quite simply:
{{ a2 -7 2, al -7 2, a3 -7 1, a4 -70}}
And with that the above simple 7r formula (10.7) was born and proven
at the same time! Child's play, really...
Short and instructive though the formula (10.7) is, it is not particularly effective. Fabrice Bellard overcame this shortcoming with the
following series:
00
7r
(_1)n(
1
= 64?; 1024n
32
1
4n + 1 - 4n + 3
64
4
4
- IOn + 3 - lOn + 5 - lOn + 7
256
IOn + 1
1)
+ lOn + 9
(10.8)
Obviously (10.8) is quicker than the two previously cited BBP series
for 7r. Our own measurements confirm the 43% saving which Bellard
128
claims for this series compared with (10.1). This improvement is based
on the fact that Bellard's formula calculates to the higher base 1024,
compared with the base 16 of the BBP series, so that he needs fewer
terms for the same search item. This formula enables one to get further
into 7r with the same amount of effort.
Bellard's series is currently the favourite amongst 7r digit hunters.
With it, Bellard and most recently the student Colin Percival have
broken several records, and as of September 2000 the latest record was
the 10 15 th binary place, a 02 (see page 203).
The BBP series and the many variants which have subsequently
been developed unfortunately can only produce hexadecimal (or binary, octal etc.) places, and this is at least somewhat exotic. It would
be nicer if we had a formula which could produce any decimal place
of 7r.
Now, for some time we have known of a constant whose hindividual
decimal places can be calculated with a BBP-like series. This constant
is In(0.9) and its related series goes like this:
In
(9)
10
L
00
= -
n=l
11
IOn
(10.9)
This series raises hopes that for 7r too a series will one day be
discovered whose denominators contain a power of 10 rather than a
power of 2, so that we can then explore decimal, and hence familiar
terrain.
Unfortunately, this is not very likely. One of the distinguishing features of the BBP formulae for 7r is the fact that they contain arctan expressions which are rational multiples of 7r to base 16. (Unfortunately)
it has meanwhile been shown that there are no arctan expressions with
the base 10, so that the search for BBP formulae for decimal places is
basically a waste of time. But perhaps someone will have a stroke of
luck in some other place.
Simon Plouffe recently showed such a different path for the decimal
place problem. He has specified an algorithm with whose aid individual
digits of 7r can be found for any base. However, the procedure has the
drawback that the time it takes to calculate is of cubic order and hence
slower than the algorithms for calculating a decimal 7r from scratch.
But even this has already been improved on. The previously mentioned Fabrice Bellard has found out how to arrive at any individual
digit of 7r in any base B in quadratic time. Here is his algorithm [19J:
10.3 Refinements
129
(alg 10.10)
sum:=
0
for (every prime number a from a = 3 to a < 2N)
{
vmax:=
m
v
s
llog(2N)j log(a)J
a vmax
0
0
1
1
b
for (k = l,2,oo.,N)
{
b:= V(~,k)' b mod m
a 2k-l
A := av (a,2k-l) A mod m
v:=v-v(a,k)-v(a,2k-1)
if (v > 0)
{
s := s + k b A-I. avmax-v mod m
}
}
s
sum
s . B n - 1 mod m
sum + -!i'i mod 1
}
At the end of the algorithm, the desired decimal place stands at the
beginning of the portion of sum which is after the base B point.
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
11. Arithmetic
11.1 Multiplication
The arithmetic operation which has by far the biggest impact on the
length of time required is the multiplication of long numbers. A program for the calculation of 7r spends almost its entire run time performing either multiplication operations or else "higher" operations
such as division or the calculation of square roots, which are actually
implemented as a sequence of multiplications. By contrast, addition
and subtraction playa relatively insignificant role.
What is the most effective way to calculate the product of two
multiplicands? The answer to this question has been the same for
hundreds of years, namely the same way as ever and as is still taught
in school.
Anyone who learned his arithmetic before the era of the pocket
calculator will know how school multiplication works: multiply the
first multiplicand with each digit of the second multiplicand, write the
product on a line underneath, then do the same for the other digits,
displacing the results by one digit as appropriate, and then add all the
lines of products together, taking into account any carryovers.
132
11. Arithmetic
Because under the school method each digit of the first multiplicand is multiplied by each digit of the other multiplicand, if both
multiplicands are N digits long, then a total of N . N = N2 individual multiplication operations must be performed. The time this takes
rises as a function of N 2 , so that it takes four times as long to multiply numbers which are only twice as long. This characteristic pattern
means that if N is large, multiplication of the two numbers takes a
huge amount of time. Even on a computer which can perform 10 million single multiplications per second, multiplication of two numbers
each a million digits long will take more than a day to perform. In a
high-precision computation with multiplicands that are considerably
longer the time required for the necessary calculations is prohibitive.
But in fact there are faster ways of multiplying numbers, and it is
not even difficult to understand how they work.
133
uo)(vo - VI)
+
(11.2)
5292
4104
3136
24 32
536464 32
Karatsuba Multiplication
9854
Ditto
(98 - 76)(32 - 54)
7632
Ditto
5292
5292
-0484
2432
2432
53646432
134
11. Arithmetic
(alg 11.3)
i f (n
{
call karatsuba(r, u, v, n/2) to calculate UI . VI
and store result in the left-hand half of r.
call karatsuba(r+n, u+n/2, v+n/2, n/2) to
calculate Uo . Vo in the right-hand half of r.
copy r to t
add UI . VI (or t) and Uo . Vo (or t + n)
to r + n/2, i.e. to the middle two quarters of r.
calculate lUI - uol in t and Iva - VII in t + n/2
note down the signs.
call karatsuba(t+n, t, t+n/2, n/2) to calculate
lUI - uollvo - VII in t + n.
if UI - Uo and Vo - VI have the same sign,
add lUI - uol'lvo - VII to r + n/2, otherwise
subtract it from r + n/2.
}
return
}
You will notice the three occurrences of the recursive call of the
karatsubaO function.
The variable limit is at least = 1, but in practice it is often greater
than this. In fact, if the operands become too small, Karatsuba multiplication ceases to be worthwhile and is then replaced by a normal
multiplication operation.
The same applies if the length n is an odd number (either from the
start or after the halving steps). "Awkward" operand length are pure
poison to the performance of the Karatsuba multiplication method,
135
which only works effectively when number lengths are powers of two.
This characteristic it shares with FFT multiplication, which is described in the next section.
Our demo implementation of the method, which you will find in
mult/karamult on the CD-ROM, works like this as well.
As we have seen, the beneficial effect of reducing the number of
partial multiplications from 4 to 3 is propagated in succeeding steps of
the procedure. In this way, Karatsuba multiplication requires a total
of only 3 k short multiplications for N = 2k -digit operands, instead of
the N 2 = 4k under the school method. As a result, the total time is
reduced from a quadratic order N 2 to the order N io g2 3 = N1.58496 ....
Applied to the above example, the multiplication of two numbers both
one million digits long no longer takes a day but a mere 5 minutes!
In view of its simplicity, it is surprising that the Karatsuba method
of multiplication is only 40 years old. Neither the ancient astronomers
nor the excellent mathematicians who lived in the centuries preceding
the invention of the computer, nor even the famous "human computers" of the 18th and 19th centuries seem to have had any method more
sophisticated than school multiplication at their disposal, despite their
staggering mathematical feats. At least, none of these eminent authorities reported otherwise [77, p. 295].
136
n.
Arithmetic
Multiplication
Addition
t
a
x b
(11.4)
Convert back
log a
+ log b
137
F(a), F(b)
"School"
multiplication
elementwise
multiplication
axb
(11.5)
F (a) . F (b)
138
11. Arithmetic
FFT's for the two multiplicands and one backward FFT for their product.
The essential ingredients of FFT multiplication are set out below.
Polynomials. A polynomial (of degree N in an Unknown x) can generally be written as P(x) = 'L-r:=oPkxk. The Pk are called the coefficients of the polynomial and are always integers here. Examples of
polynomials are A(x) = 8x 3 + 7x 2 + 8x + 9 or B(x) = 4x 2 - X + 2.
Multiplication of polynomials. We use these examples A(x) and
B(x), and multiply them into a product polynomial C(x):
C(x) =
A(x)
x
B(x)
2
2
= (8x + 7x + 8x + 9) x
(4x - X + 2)
= 32x 5 +28x 4 +32x 3 +36x 2
-8x4
-7x 3 -8x 2 -9x
+16x3 +14x2 +16x +18
3
139
ai, bj
ai x b1:
ai x bo:
67
48
Ck
24
do
d1
d2
d3
11
x 89
56
54 63
110 63
6
3
6
:3
aw :=
N-1
N-1
k=O
k=O
II
II
II
II
-2.0*M_Pl/n;
Complex t = 0.0;
for (long k=O; k<n; ++k)
{
140
11. Arithmetic
res [w] = t;
}
f[k] = res[k];
There are two different reasons why the above abstract definitions
of the FT, apparently a matter of luck, are the key to rapid multiplication: firstly the convolution theorem and secondly the existence of
fast techniques for the calculation of Fourier transforms.
141
II
II
II
#include <iostream.h>
#include <Complex.h>
typedef complex<double> Complex;
II
II
function prototypes:
II
see below
II
II
II
getdigs.cc
print.cc
print.cc
142
11. Arithmetic
int mainO
{
cout
II
II
II
II
main loop
II
II
II
II
II
II
II
II
II
II
II
"Base=" base
", na=" na ", nb=" nb
", nc=" nc ", nf=" nf endl;
143
c [k] I base;
Digit carry
c [k]
carry * base;
c [k-l]
+= carry;
11,
c, nc);
return 0;
}
II
II
II
II
II
fftO
n
isign
long mh = m I 2;
double phi = pi I mh;
for (long j=O; j < mh; ++j)
{
double p = phi * j;
Complex cs = Complex(cos(p), sin(p;
for (long tl=j; tl < j+n; tl += m) {
Complex u = f[tl];
Complex v = f[tl+mh];
f [tl] = u+v;
f[tl+mh] = (u-v) * cs;
}
II data reordering:
for (long m=l, j=O; m < n-l; ++m)
{
{;}
Complex t = f[m];
f[m] = f[j];
f[j] = t;
}
II --------------------------
144
11. Arithmetic
In the program, the function fit (), which performs the fast Fourier
transform, is used instead of the function sft () (slow Fourier transform) shown on page 139. Its source code is shown at the end of the
program listing. Compared with the slow variants, in the fast variant the length of the complex arrays must be a power of two (the
smallest ~ na + nb), because - as mentioned previously - the speed is
achieved through recursive halving of the multiplicands. After forward
and backward transforms, the results are shifted by one digit towards
the right because the transformation leaves the right-most place empty
(the convolution product of digits i and j moves to position i + j, and
simultaneously the convolution product of the right-most places na-1
and nb - 1 move to position na + nb - 2). Finally the carryovers are
resolved. The other operations in the program should be clear from
the foregoing and from the comment statements within the program
itself.
Comparison. The fast Fourier transform passes its speed on to the
FFT multiplication, in which it is called three times. For this reason,
the time taken to perform an FFT multiplication rises only proportionally N log2 N to the length N of the multiplicands. The effect is
considerable when N is large, as the following graph demonstrates.
Time required
School multiplication
c.
FFT multi lication
N1.583
c' N log N
Operand length
11.4 Division
145
11.4 Division
The conventional method of performing long division as taught in
schools should not be used to divide long numbers u and v. Instead
it is replaced by two operations, namely one multiplication and one
reciprocation, in accordance with the following schema:
u
1
- =u.(11.6)
v
v
We have already dealt in detail with multiplication operations. For
the reciprocation ~ of long numbers, the method still used today is
that devised more than 300 years ago by Isaac Newton (1642-1727)
for determining a zero of a function. As long as certain conditions for
continuity are satisfied, then Newton's method determines a zero of a
function f(x) iteratively with
Xi+l = Xi -
f(Xi)
!'(Xi)
(11.7)
146
11. Arithmetic
k
0
1
2
3
Xi
xi(1 - v . Xi)
Xi+l
0.1
0.13
0.1417
0.14284777
0.03
0.0117
0.0011477
0.00009372
0.13
0.1417
0.14284777
0.14285714
Accurate Places
1
2
4
8
147
long radicand d occurs there at least once per iteration, and this has
to be calculated for the full length of the results.
If you can still remember how square roots were calculated at
school, then forget it as there are some far more effective methods
of performing this calculation.
= Xi
+ Xi
1 - d x2
2 z
(11.9)
Coupled Newton iteration. Arnold Schonhage succeeded in arriving at a significantly more effective solution on the basis of an apparently inferior approach [104, p. 257]. His method calculates the square
root Vd directly and ascertains the zero of the function f (x) = d - x2 ,
for which from (11.7) the following iteration rule is derived:
d - x2
Xi+ 1
= Xi + -2-_z
Xi
(11.10)
Each step of this contains an expensive division, which "really" disqualifies the procedure. However, there is a wonderful trick which reduces this drawback so effectively that the total time required is less
than under the first method we mentioned. This is known as the coupled Newton iteration and works with the following double iteration:
148
11. Arithmetic
(alg 11.11)
Initialise:
Xo :::::; Vd
Vo := 1/(2xo)
Iterate:
Vi+l
Xi+l
+ (1 := Xi + (d := Vi
2XiVi) . 'I7-t-t
1/(2Vd)
X;) . VH!~~
Vd
Instead of dividing, the procedure entails multiplying by an approximate reciprocal Vi+l = 1/(2xi) which is improved before the start of
the current iteration in a coupled iteration from Vi and Xi.
The time required to perform this calculation is asymptotically 7/3
long multiplications, which in reality expand to 3 long multiplications.
For more about this, see the implementation contained in the hfloat
library under hfloat/src/hf/itsqrt. cc
A recursive MuPAD procedure for calculating the square root looks
like this (after [4]):
Sqrt_Coupled_Newton := proc(d. n)
II assume d >= O. n >= 1
local m. g. h. x. e. f. t; II v is static! begin
t := DIGITS;
II save global precision
if n <= 2
then
DIGITS := n;
x := sqrt(d); II Initial value of x
DIGITS := t;
return(x);
end_if;
m := floor(n/2)+1;
x := Sqrt_Coupled_Newton(d. m);
DIGITS := m;
if m <= 2
then
v := 1/(2*x);
else
g := 1 - 2*x*v;
h := g * v; II v from the previous iteration
v := v + h; II now v is of precision m
end_if;
DIGITS := n;
e := d - x-2;
f := e * v;
:=
+ f;
DIGITS := t;
II restore global preCision
return(x); end_proc:
149
\fi5
V'd n - 1
\fi5
with y := 1 - xn D
(11.13)
_1_ _
vD
nlT'\ -
(1 + It + (1 +
n
(1
n)y2
2 2
n
(1
+ n)(l + 2n)y3
6 3
n
l)n)yk
+ ... +
+ ... )
(11.14)
(11.15)
Xi+1 =
(11.16)
150
11. Arithmetic
in fact, precisely the iteration rule (11.9) which we saw in the last
section.
The following table contains the four iteration rules for the cases
n = 2,3 and k = 2,3:
{j~
Order of
convergencE
f/~
D= d'l.
Yi = (1 - xtD)
D=d
Yi = (1 - x;D)
Xi+l = xi(l
Xi+l = xi(l
+ yi/2)
+ yi/2 + 3y; /8)
Xi+l = xi(l
Xi+l = xi(l
+ yi/2)
+ yi/3 + 3y; /8)
~=1-l+~-~+- .. =f)-1)k2k~1
(11.17)
k=O
This converges so poorly that no less than lO n terms have to be calculated for n accurate decimal places.
It is all the more surprising that there is an algorithm which speeds
up calculation of this series enormously. With this algorithm it is possible, for example, to obtain 1000 accurate decimal places from only
1307 summands, instead of a massive 101000. Even better, the algorithm can not only be used for the Leibniz series but also for many
other series. The only firm condition is that the terms of the series
must alternate, i.e. each positive term must be followed by a negative
term, which in turn is followed by another positive term. In addition,
the series terms have to be simple to calculate and the desired precision
of the series sum must not exceed a certain limit, e.g. 1000 decimal
places.
This astonishing procedure was developed by Henri Cohen, F. Rodriguez Villegas and Don Zagier [42]. In their paper, the authors describe a whole class of algorithms for other applications. We will confine
ourselves here to the most elegant of these. It is aptly named sumalt.
151
The critical discovery lies in the determination of universal coefficients which are independent of the series to be calculated and by
means of which the convergence of the series can be significantly accelerated.
The algorithm approximates the sum s = L:~o ak with alternating
ak through a weighted sum of ao, aI, ... , an-l with universal coefficients Cn,k/ dn . Both Cn,k and dn are integers. For the first n we obtain
the following values:
n
1
2
3
4
dn
3
17
99
577
cn,o
2ao
16ao
9Sao
576ao
Cn,l
Cn ,2
Sal
SOal
32a2
544al
3S4a 2
Cn ,3
12Sa3
bn,n-l := 22n -
(ILlS)
Cn,n-l := bn,n-l
(11.19)
(2k
+ l)(k + 1)
+ k)
(k = n - 1, n - 2, ... ,0)
+ bn,k-l
(11.20)
(11.21)
0;
II temorary var.
II Cn,k
II
bn,k
152
11. Arithmetic
ak
t;
b := b * 2*k+1)*(k+1))/(2*(n-k)*(n+k));
c := c + b;
end_for;
s := sic;
I I last Cn,k = dn
return( s );
end_proc:
Just how closely this algorithm approximates the Leibniz series can
be seen from the following table:
n
1
2
5
10
20
30
sumalt(n)
0.666666666666666666666666666666
0.7843137254 90196 0784313725 49019
0.785396636600918492087091551855
0.785398163452432892329702343038
0.785398163397448309920667687680
0.785398163397448309615660848818
Accurate places(D)
0
2
5
9
18
26
4-
0.785398163397448309615660845819
30
7r
12. Miscellaneous
12.1 A
7r
quiz
One of the few women who is actively engaged in the "7r scene" is Eve
A. Andersson. She has put on the Internet a quiz called "The Pi Trivia
Game" which gives us the "chance to pay tribute to the magnificent
transcendental number that we have all grown to love" .1
The quiz consists of 25 questions from Eve's "7r question database" .
The whole test is too long to print here, but a few of the questions are
provided below:
1. Consider the following series of natural numbers, constructed by
successively larger strings of digits from the beginning of the decimal expansion of the number 7r: 3, 31, 314, 31415, 314159, 3141592,
etc. Out of the first 1000 numbers in this series, how many are
primes'?
e) 58 ?
c) 4
d) 21
b) 34
a) 48
2. What is another name for
a) el numero buono
b) die Ludolphsche Zahl
c) Gesundheit
d) die Eulersche Zahl
e) Drei
7r
in Germany?
http://eveander.com/trivia/
154
12. Miscellaneous
Solutions:
1.: c), 2.: b), 3.: b), 4.: c).
Most people are surprised at the answer to question 1. Among the
first 1000 initial sequences of 7r there are indeed only four prime
numbers, and they occur right at the beginning: 3, 31, 314159 and
3 1415926535897932384626433832795028841. Whether there are
any other prime numbers greater than 38 digits long at the beginning of 7r is not known; at any rate it is certain that there are no other
prime numbers less than 5000 digits long.
places) of
v0i ~
7r.
553
311 + 1
ViF
(12.1)
(12.2)
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
Magic square
'IT
1["
2
4
3
6
9
2
7
3
6
5
4
2
1
9
9
4
8
6
3
8
1
3
5
5
3
(17) (29) (25) (24) (23)
Square modified with 7r
=2
155
(24)
(23)
(25)
(29)
(17)
= 2
1/2
1
1/2
. 2k
I1m
71"
"2
k-+oo
1["
The semi-circle on the left has diameter 1 and the length of its arc
is
The diameters of the two semicircles immediately to the right
are half as long, but their arcs are i long. Again, the arcs of the
4 semicircles in the middle and the 8 semicircles in the last but one
diagram also total in length. If one continues this an infinite number
of times, the wavy line is eventually transformed into a straight line
of total length i which is equal to the total of all the diameters, i.e. 1.
Hence,
i.
~=1
2
7r
=2
1["
2 k+l =-2
q.e.d.
156
12. Miscellaneous
1['
~ + ~ - ~ + .. -)
= 4 (1-
(12.3)
This series is also notorious for its poor convergence which makes it
unsuitable for 1[' calculations. After the nth term the error is still ~. To
obtain 100 accurate decimal places of 1[', for example, ~ would have to
be equal to 10- 100 , i.e. n = 10100 , and that is greater than the number
of particles in the entire universe.
However, the series compensates to some extent for its poor convergence with an unusual property. Sometimes after running past the
first incorrect digit it continues correctly for a good-sized section. Look
at the value which the series produces after 50,000 terms and compare
it with the first correct decimal places of 1[':
50000 (
1)k-1
;k
k=l
whereas
1
1['
=3.14157265358979523846264238327950 ...
11'
11'
11'
(12.4)
= 3.14159265358979323846264338327950 ...
In the results, the 5th decimal place is already incorrect, and this is not
expected to be otherwise in the 50,000th term of the above estimate.
But after this incorrect digit, the next 9 digits are entirely correct!
Then we get another 8 digits correct, and after another incorrect digit
another 8 correct ones. Altogether, only 3 out of the first 33 digits are
incorrect (the ones marked as such above).
R.D. North of Colorado Springs, USA, drew this peculiarity to the
attention of the Borwein brothers. Martin R. Powell had also noticed
this strange feature back in 1982 after 13.5 hours of computer analysis
on his school computer (see [93]). The Borweins and their colleague
K. Dilcher looked into the phenomenon and clarified the mathematical
background in an article [35].
157
_
7f
4L
(_1)k-1 _
2. _ ~
2k _ 1 - N
_ 122
2770 _ 101042
N3 + N5
N7 + N9
++(-1)
m 2 E2m
+ ...
N2m+1
Nll
k=1
(12.5)
Here the numerators 2, 2, 10, 122, 2770, 101042, ... represent the
Eulerian numbers E2m, multiplied by 2. N must be divisible by 4.
If we set the value 105 for N in (12.5), the first four terms of the
residual sum are then +2 . 10- 5 = 0.00002, -2 . 10- 15 , +1 . 10- 24
and -1.22 .... 10- 33 . However, all this means is that the 5th and
15th decimal places are incorrect by -2 and the 24th decimal place is
incorrect by +1, but the rest of the first 33 places are correct.
In the meantime, the subject has been discussed further in the
literature. In [5] we learn that the asymptotic formula (12.5) could
have been discovered in only one second if the Maple computer algebra
system had been fed this line of code:
asympt(simplifysum(-4*(-1)-j/(2*j-l),
j=1 .. n/2)-Pi) /(-1)-(n/2+1)),n,8);
Before this discovery was made, the Borwein, Borwein and Dilcher
article ranked as an example of the superiority of man over computer,
but this new finding suggests otherwise.
But, to be fair, one must say that the curiosity discovered by North
for decimal places only applies if N is a power of 10. If, for example,
only one single series term is added in (12.4), then the result looks
quite different:
50001 (
1)k-1
4L ;k _1
k=1
= 3.14161265318979923842264278327550 ...
1M'I
11
11
11
1M'I
11
1f.
(12.6)
158
12. Miscellaneous
12.7
7r
and hyperspheres
A circle has the area 7rr2 and a sphere the volume ~7rr3. In both
formulae 7r appears to the first power.
When considering all multi-dimensional objects, it simplifies matters if one can speak generally in terms of "sphere" and "volume".
Thus, for example, a circle may be understood as a 2-dimensional
sphere and its area as 2-dimensional volume. Thus, the I-dimensional
circle diameter also has a volume which amounts to VI = 2r; 7r does
not occur at all in this expression or only to the Oth power.
How does one calculate the volumes of spheres which have more
than three dimensions ("hyperspheres")? They can be determined
through integral calculus, e.g. using the recursion formula [73, p. 179ff]
(12.7)
This formula takes us from VI to V2, from V2 to V3 and from there
in turn to the volumes of higher spheres which are too complex for us
to imagine:
r
V2
= 21
VI (y)dx
= 21
V3
2ydx
= 41
21 V2(y)dx
= 27r(r 2x
2
21 7ry dx
Jr2 - x 2dx
r
= 21
= 7rr2
(12.8)
7r(r2 - x 2)dx
3
- =-)
3
4 3
= -7rr
(12.9)
12.7
'/r
and hyperspheres
159
(12.11)
n
k/2 k-l
Ok (r ) = (kj2)! 7l" ' r
(12.12)
(12.13)
It will now be clear how the exponents of 7l" are determined, i.e. as 'half
dimension', if necessary rounded to the next lower integer.
This is confirmed in the following list of volumes and areas of selected hyperspheres together with the numeric values in the case r = 1:
Dimensions
k
1
2
3
4
5
6
7
8
9
10
20
100
Volume
Vd1")
21"
'/r1"2
'/r1"3 .
4/3
8/15
7 . 16/105
'/r4 r 8/24
'/r4 r 9
32/945
'/r5 r lO /120
lO 20
'/r 1" /1O!
'/r50 r lOO /50!
Surface
Vk(l)
2.0
3.14
4.19
4.93
15.261
5.17
4.72
4.06
3.30
2.55
0.0258
2.10- 40
Dd1")
2
'/r1"/2
2
'/r1" 4
2
'/r 1"3 . 2
2
'/r 1"4 8/3
'/r3 r 5
16/15
7/ 3
'/r4 r 8 32/105
'/r5 r 9/12
lO 19
'/r 1" /10!
'/r50 r 99/50!
'/r3 1" 6 .
'/r4 r
Dk(l)
2.0
6.28
12.57
19.74
26.32
31.01
133.071
32.47
29.69
25.50
0.516
2.10- 38
In the columns with volumes Vk(l) and surfaces Ok(l) for the unit
spheres, it is striking that with 5 and 7 dimensions a maximum occurs
160
12. Miscellaneous
up to which the values continue to get bigger but after which they become smaller and converge towards O. The unit hyperspheres seem to
expand initially as the number of dimensions is increased, and thereafter to contract in on themselves, even though their radiuses remain
unchanged (= 1). "Imagine that if you can" .
Individual sums of these terms are also interesting if one continues
them infinitely. Thus, for example, the volumes of the unit hyperspheres with even dimensions add up to a particularly simple expression,
00
L V k(1) = err
(12.14)
k=l
and the total values of the volumes and areas are very nearly integers.
00
(12.15)
k=l
00
(12.16)
k=l
(;;;)
",,00
(-1) k rr "
k!(2k+l)
Is that an accident?
One might surmise from the formulae for the 3-dimensional sphere
r3 7f) and other 3-dimensional bodies such as the circular cylinder
(r2 H 7f) that 7f generally occurs to the first power in the volume of
smooth 3-dimensional bodies. But in fact this is not the case. For
example the torus ("annulus") has the volume 2Rr2 7f2, and here 7f
occurs to the second power.
(!
12.8 Viete
Wallis
Osler
The history of 7f contains the interesting detail that virtually the two
first infinite expressions for 7f were infinite products, whereas almost all
the other similar expressions are infinite sums. These are the famous
products of Fran<;ois Viete (1540-1603), 1593,
Osler
161
(12.17)
ViHe, 1593
(1616~ 1703),
1655,
13 35 57 79
22 44 66 88
(12.18)
Wallis, 1655
2
- =
7r
1
2
II
1
2
~+-
n=l
(n radicals)
oo
II
n=l
2p+1n - 1
2P+l n
2p+1 n
+1
.----~-
2P+l n
(12.19)
Osler[88], 1999
162
12. Miscellaneous
_ 0.1 -
p -
'IT
13 . 35 . 57 . 79 . JU.l.
22 44 66 88 1010
11-13 ...
1212
=
P = 2 .1
'IT
V '2
Vfi.
'2
4-4
88
J+
1.
2
1212
1. fi
2 V'2
1616
1921 ...
2020
P=3:~={f.J~+~{f. ~+~J~+~{fx
x 1517 . 3133 . 4749 . 6365 ...
1616
3232
4848
6464
(12.20)
Viete, 1593
163
U1 U2 U3 U4
U2 . U3 . U4 . U5 ...
U1
= Uoo
(12.21)
The Viete formula now becomes immediately clear. The inner numerators and denominators cancel out in pairs, leaving the first numerator
U1 and the last denominator U00' U1 is equal to the perimeter of a
digon, i.e. it is equal to twice the diameter 4. Uoo is the perimeter of
a 2O-sided polygon and therefore identical to the circumference 27r,
hence
4
2
U1
(12.22)
Uoo 27r 7r
i.e. equal to the left-hand side of (12.20).
For the Wallis product,
7r
2 . 4 4 6 6 8 8 10
-=--.--.--.--.
4
33 55 77 g.g
=
11 (
- (2n
(12.23)
~ 1)2 )
(12.24)
Wallis, 1655
.............
012345
..
0 .. 7
The area of the figure on the left without the black square clearly
comes to 1 - ~ = 0.888 .... Now take the 8 remaining sub-squares,
divide each one into 5 x 5 squares and once again punch out the middle
of each one. After performing this operation, the total area of the figure
164
12. Miscellaneous
is only (1-~). (1- 2\) = 0.853 ... (centre diagram). In the next step,
each of the remaining 24 squares is divided into 7 x 7 squares and
once again the centre square of each one is punched out (right-hand
diagram).
The process only needs to be continued to infinity to obtain a total
area of 7r / 4 = 0.78539816 .... But significantly earlier than this, after
perhaps 3 or 4 iterations, one obtains an attractive "Wallis pattern".
y=~
x
The symbol
1r
research may date back to ancient times, but the name "1["" is of
relatively recent provenance. It was only in the 18th century AD that
the concept came to be referred to with the Greek letter 1[". Before
that it was necessary to describe it in a roundabout way, for example
using a description like [114, p. 278] quantitas, in quam cum multiplicetur dyameter, proveniet circumferentia (the quantity which, when the
diameter is multiplied by it, yields the circumference).
The person who invented the symbol 1[" is assumed to have been
the Englishman William Jones (1675-1749), because he used 1[" in the
sense as it is used today in his Synopsis Palmariarum Mathesos, a
compilation of notable mathematical exercises published in 1706. On
page 263 he gives the following statement [68]:
1["
166
7r
7r
However, neither this nor the other derivations given at this point
in the text are actually the work of Jones, but rather they flowed
from "the accurate and Ready Pen of the Truly Ingenious Mr. John
Machin" (1680-1752), to quote Jones's own Introduction. The symbol
7r must therefore be attributed to the same man who had already
earned his place in history with his arctan formula (5.13) and his record
calculation of 7r to 100 decimal places (see page 192).
Some authors had used the letter 7r even earlier for other variables
relating to the circle. Thus already in 1631 we find it used by William
Oughtred (1574-1660), who was one of John Wallis's teachers. In his
Clavis M athematicae Oughtred used the symbol 7r to denote a length
equal to half the circumference of a circle and the symbol 0 for the half
a diameter when he established the proportion 7 : 22 = 0 : 7r = 113 :
355 [114, p. 302]' so that "our" 7r was the same as "his" 7r : O. 7r was
also used in a similar way in 1669 by Isaac Barrow (1630-1678)[41,
p.91].
For 30 years Jones's or, more likely, Machin's invention was not
repeated by anyone else. Other symbols were tried instead. Johann
Bernoulli (1667-1748), for example, employed the Latin letter c and
Leonhard Euler (1707-1783) used first p in 1734 and then c in 1736.
A revival of the symbol 7r occurred when Euler used it again in
the treatise he wrote in 1736 entitled Mechanica sive motus scientia
analytice exposita. From Euler, "not least due to his extensive correspondence" (Tropfke) with all and sundry, the symbol soon spread
to other mathematicians as well [114, p. 303]. It had finally won the
day when Euler used it in his famous 1748 publication in Latin, Introductio in analysin infinitorum (Introduction to the Analysis of the
Infinite) [52]. In this work, Euler introduced it with the words, "For
the sake of brevity we will write this number as 7r; thus 7r is equal to
half the circumference of a circle of radius 1 or equal to the length of
an arc of 180 degrees." [53, p. 95].
Again, the handy and commonly used term "radius", also appeared
only relatively recently. Contrary to what one would expect, it dates
not from antiquity but first appears in a book published in 1583 [114,
p. 134]. However, from that date on it was virtually the only word used
for the concept. The Greeks too did not call the radius half-diameter,
13.1 Antiquity
167
13.1 Antiquity
Babylon
A clay tablet unearthed in 1936 from the Old Babylonian period, approx. 1900-1600 BC, states that the circumference of an hexagon is
0;57,36 (in base 60) = 96/100 = 24/25 times the circumference of the
circumscribed circle [72, p. 18]. From Uhexagon = 3 d = 24/25 Ucircle =
24/25 7r d we get what is perhaps the oldest approximation to 7r,
7rBabylon
= 3 = 3.125 = 7r - 0.0165...
(13.1)
Egypt
In ancient times it was not absolutely essential to calculate the circumference of a circle, as it could always be measured. On the other
hand it is quite difficult to arrive at an accurate figure for the area of
the circle by measurement, so that it was highly desirable to be able to
calculate it. Problem no. 50 in the Egyptian Rhind Papyrus (named
after A. H. Rhind, a Scot who purchased it in 1858 in Luxor), which
dates back to around 1850 BC, reads as follows [72, p. 18]: "Example
of a round field of diameter 9. What is the area'? Take away 1/9 of the
diameter; the remainder is 8. Multiply 8 times 8; it makes 64. Therefore, the area is 64." The Egyptian scholar was thus using the formula
A = (d - d/9)2 = (8d/9)2. When this is compared with the formula
for the area, A = 7r d2 /4, we obtain the approximation
7rEgypt
= "9
7r
+ 0.0189 ...
(13.2)
168
7r
India
The Indian Sulva8utra8 (which means "cord rules", i.e. rules for
building altars of certain shapes with the aid of pieces of cord [51,
p. 102]), which is certainly older than the surviving version dating
from 600 Be [72, p. 4], also describes a calculation of the area of a
circle: "If you wish to turn a circle into a square, divide the diameter
into 8 parts, and again one of these eight parts into 29 parts; of these
29 parts remove 28, and moreover the sixth part (of the one left) less
the eighth part (of the sixth part)." This produces a side length 8 of
the required square of
d~ (7 + 29 (1 - ~ (1 - ~) ) )
1
8=
8
= d 9785
11136
and hence
1flndia =
48
/d
9785
5568 )
= 3.08832 ... =
1f -
0.0532 ...
(13.3)
13.1 Antiquity
1r
v'1O =
3.16227. . .
169
(13.4)
All the great Greek mathematicians of the classical era from the 5th
to the 3rd centuries BC worked on problems relating to circles. One
discovery that was especially important for 1r mathematicians was that
of the method of exhaustion. Under this method, which is attributed
170
to Antiphon (c. 430 Be) or Eudoxos (408-355 Be), the area of a twodimensional figure such as a circle can be arrived at through mental
"exhaustion" using ever more elaborate versions of figures whose areas are known, such as polygons. Euclid (c. 330-275 Be) used this
method, for example, to prove the theorem that the areas of circles
are proportional to the squares of their diameters.
Yet none of the eminent Greek mathematicians, from Anaxagoras
(c. 499-428 Be) to Euclid, seems to have improved on the numeric
value of 1f. The Greeks were geometricians; algebra did not interest
them. They were more interested in geometric aspects of circles such
as the problem of squaring the circle. This refers to the problem of
how to construct a square whose area is equal to the area of a given
circle. Several mathematicians had already produced solutions to this
problem when Euclid increased the difficulty of the requirement by
specifying that it must be solved only with an (unmarked) compass
and (unmarked) straight edge. As was only established in 1882, these
additional conditions make the squaring the circle insoluble.
Nevertheless the philosopher Plato (427-348 Be) is supposed to
have obtained what for his day was a very accurate value for 7r, V2 +
03 = 3.146 ... [51, p. 126]. This expression shows that Plato probably
arrived at the formula as the arithmetical mean of the half-perimeters
of the inscribed square 2V2 and the circumscribed hexagon 203. As
these initial values, with 3.464 ... and 2.828 ... , are somewhat weak
approximations for 7r, and yet the end value is quite accurate, one is
attempted to interpret this as a typical case of the non-mathematician
striking it lucky.
13.2 Polygons
After the initial phase largely consisting of empirical approximations,
the Greek mathematician Archimedes of Syracuse (287-212 Be) inaugurated the first theoretical phase in the mathematics of 7r. Using
a new method, he attained a milestone around 250 Be when, for the
first time, he systematically approximated the number 7r and produced
upper and lower limits on its value. In his book The Measurement of
the Circle he stated three theorems about the circle, the third of which
goes as follows:
3. The ratio of the circumference of any circle to its diameter is
less than 3 ~ but greater than 3 i~
13.2 Polygons
171
Today the left- and right-hand limits are generally transposed so that the theorem
is written as 3 +
< 7r < 3 + ~, but in Archimedes's time it was customary
to write it as shown above; moreover it was the upper limit which he calculated
first.
172
iT
Circumscribed polygons
Inscribed polygons
C
D
(CO
+ OA) : CA = OA: AD
OA 2 + AD2 = D02
(13.7)
(13.8)
(AB
+ AC) : BC = AD : DB (13.9)
(13.10)
AD2 + DB2 = AB2
The labels in the pictures are the same as those used by Archimedes.
Lines AG and BG denote the half sides of a circumscribed or inscribed
polygon with n-sides, AD and B D denote the half sides of the "succeeding" 2n-sided polygon; G D and AD thus have the effect of halving
angles AGG and BAG.
The formulae (13.7) and (13.9) can be derived from elementary
geometry, but this is not a trivial task. Archimedes had to calculate
them without trigonometric half-angle formulae, and with little in the
way of formulae to refer to.
The formulae, which enable the transition from polygons of n sides
to polygons of 2n sides, gave Archimedes in the circumscribed as in
the inscribed case two completely symmetrical sequences of numbers
of a6, a12, a24, ... , a96 and b6 , b12, b24 ,., b96 , which are related to
each other as follows:
a2n
= an + bn
b2n
Ja~n +
(13.11)
c2
(13.12)
13.2 Polygons
173
+ 2a >
~
2
V a
b
+ > a + 2a + 1
(13.14)
which were known long before his time, probably already in the time
of the Babylonians. In the above formulation a 2 is the next lower or
next higher perfect square below or above the radicand a 2 + b. This
formula (13.14) produces the following on the first occasion that a = 2
and b = -1 are used:
1
2-->V3>2-7
5
->V3>4
Of the two limits, the left one provides a better approximation but
the right one contains the smaller numbers and therefore Archimedes
could have chosen 5 as an approximation for 3v1s = V27 and used
13.14 once again.
2
2
5 + 10 > 3V3 > 5 + U
26
19
15 > V3 > U
If he now used the 26 from the left-hand side as an approximation
for ff.152 = )675, then after applying (13.14) again he could have
arrived directly at 13.13 via
1
1
26 - - > 15V3 > 26 - 52
51
1351 >
V3 > 1325 = 265
780
765
153
174
7r
In any case, Archimedes took the numerators 1351 and 265 from
(13.13) for the a6, the denominators 780 and 153 for the c, and 2 c
(from "Pythagoras") for the b6 . He then performed four iterations for
each of the 12-, 24-, 48-, and 96-sided polygons. In each iteration he
had to approximate a square root using a fraction, and for this he
evidently used the same effective approximation method (13.14) that
he had used for the initial \1'3. In any case the basic inaccuracy of the
area of the 96-sided polygon instead of the area of the circle remained
greater by factors (8 and 3) than that of the calculation. The mathematical procedure, most of which has survived (only the expressions
in square brackets have been added) can be represented as follows [64,
II, p. 55]:
Inscribed polygons
Circumscribed polygons
b
a
b
c
n
a
c
153 6
1351
1560
265
306
780
2911
571 > [V571 2 + 1532 ] 153 12
< V2911 2 + 780 2 780
< 30131.1.
> 591~
2 4
2
780 1
1162~ [J(1162~)2 + 153 ]153 24 59241.1.
2 4
> 1172~
1823
< 1838t1
2334~ (J(1162~)2 +
1532 ]153
48
> 2339~
4673~
153
96
3661 t1
1007
< V10072 + 66 2
< 1009i
+ 66 2
66
< 2017i
IHere the fractions of a and c are reduced to simpler expressions.
At the end Archimedes had, with C96 : a96 and C96 : b96, calculated
approximations for the ratio of polygon side to diameter whose relative
error was less than 4.10- 5 both for the circumscribed and the inscribed
96-sided polygons. Through multiplication of the fractions C96 : b 96 and
C96 : a96 by 96 he arrived at
667~
96153
7r
667~
(13.15)
and
96 . 66
7r
> 20171.
6336
284~
= 20171. = 3 + 2017.!
4 4 4
10
> 3 + 71
(13.16)
13.2 Polygons
175
U.
176
first value is, there must be something wrong overall as both values
are greater than 7r.
400 years after Archimedes's time the Greek astronomer Ptolemy
(150 AD) also came up with the approximation 3.1416. It may be
that he discovered this approximation by simply deriving the approximate value 38'30" = 3
from the sexagesimal representations of
Archimedes's limits, 3~ = 38'34.28" and 3 ~? = 38'27.04" [114,
p. 275J, or else he may have separately summed the numerators and
denominators from their fractions 3 + 1/7 = 154/49 and 3 + 10/71 =
223/71 to arrive at the mean value of 377/120 [51, p. 127J.
No
Rome
As far as we know, the Romans did not make any further progress in
the mathematical analysis of circles. As late as 15 BC no more precise
a value than 7r = 3 appears to have been either required or known. Surveying in Roman times was evidently not particularly accurate [114,
p.277J.
China
When Wang Mang came to the throne at the end of the Western
Han dynasty (206 BC-24 AD) he commissioned the astronomer and
calendar expert Liu Xin to develop a standard measurement for his
empire. Liu Xin's response was to produce a cylindrical vessel made
of bronze. It is assumed that around 100 copies of this were made and
distributed throughout the country. One of these has been preserved
in the Peking Palace Museum. From analysing it, historians have concluded that Liu Xin must have possessed a 7r approximation which
was significantly better than 3 and may even have been the accurate
value of 3.1547. This would then have been around the beginning of
the Common Era.
This and also everything else we know about the history of 7r in
China comes from an paper [78J by Lam Lay-Yong and Ang Tian-Se,
most of which has been confirmed by [51].
Around a century later Zhang Heng (78-139 AD) improved the
value of 7r experimentally in the following manner. In his day the ratio
of the area of a square to an inscribed circle was assumed to be 4 : 3.
By analogy, Zhang Heng calculated that the ratio of the volume of a
cube to that of an inscribed sphere was its square, i.e. 4 2 : 32 = 16 : 9.
13.2 Polygons
177
178
3.1415926 <
7f
< 3.1415927
(13.20)
This interval, with its 7 accurate decimal places, held the world
record for 800 years, although to all intents it remained a secret as
even in China the two limits were not rediscovered until the fourteenth
century.
13.2 Polygons
179
355
113 = 3.1415929 ...
(13.21)
India
In 499 AD the astronomer Aryabhata (born 476 AD) wrote a work
called Aryabhatiya. His theorem 10 (out of 133 theorems) goes as follows [72, p. 203]:
"Add 4 to 100, multiply by 8 and add 62,000. This is the approximate circumference of a circle of which the diameter is
20,000."
This produces a value for 7r of 62832/20000 = 3.1416. However, this
value is suspected of being of Greek origin, possibly even originating
from Archimedes, and of having found its way to India like many
other things. But Aryabhata may have calculated it himself, for he
demonstrated that if a is the length of the side of a polygon with n sides
which is inscribed in a circle of diameter 1, and b is the length of a side
in a polygon with twice as many sides 2n, then b2 = (1 - ~) /2.
Beginning with a hexagon he calculated the side lengths of polygons
with 12, 24, ... , 384 sides. The perimeter of the last polygon he stated
180
7r
Middle Ages
In Europe in around 1220 Leonardo of Pisa (1180-1240'1), better
known by the name Fibonacci, independently calculated the value
864/275 = 3.14181 ... from a 96-sided polygon, without drawing on
Archimedes's work. His approach was more accurate than Archimedes's,
but not as systematic, so according to Tropfke his 3 correct decimal
places owe more to chance than to his calculation method.
It is said that Dante Alighieri (1265-1321), author of "The Divine Comedy", possessed the approximation 7'1 = 3 + )2/10 =
3.14142 ... [41, p. 68].
At any rate it was Dante who composed that secular verse which
could aptly summarise all the endeavours of 7'1 researchers 2 :
As the geometer his mind applies
To square the circle, nor for all his wit
Finds the right formula, howe'er he tries, ...
2
Paradise, Canto XXXIII, lines 133-135, translated by Dorothy Sayers and Barbara Reynolds.
13.2 Polygons
181
All in all, the European Middle Ages saw little progress in the matter of 7r. Thus in 1464 the man regarded as the greatest European
mathematician of the fifteenth century, Regiomontanus (1436-1476),
whose real name was Johannes Muller, used a value of 3.14243 for
7r. And Adrianus Metius (1571-1635), rated equally important, was
using nothing better than Tsu Chhung-Chih's approximant 355/113
which the Chinese mathematician had discovered 1000 years earlier,
and even this he only found through a happy accident when he calculated the mean values of the numerators and denominators of two
limits (377/120 and 333/106) [14, p. 343]. At a time when the mathematicians themselves could not produce anything better than this, we
should praise the approximation of 7r = 3i = 3.125 which the artist
Albrecht Duerer (1471-1528) used, 3500 years after the Babylonians
had first invented it. This value can at least be well constructed with
a compass and ruler.
182
7r
= 6.2831853071 79586 5
To find the values of the sine and tangent, Viete applied the formula
2 sin 2 () /2 = 1 - cos () [14, p. 343] iteratively.
Several other Dutchmen then went on to leave their mark on the
history of 7f. The first of these was Adrian van Romanus (1561-1615),
who in 1593 achieved distinction by calculating polygons with one billion sides in order to arrive at 15 accurate decimal places. Three years
later, in 1596, he was surpassed by Ludolph van Ceulen (1539-1610), a
professor of mathematics at the University of Leyden. At first Ceulen
calculated only 20 digits, for which he used the perimeters of the inscribed and circumscribed regular polygons of 60 . 233 ~ 480 billion
sides.
13.2 Polygons
183
184
7r
(13.23)
Gregory, c. 1667
= J2, r4 =
1; r2n
1
"2(rn
+ R n ),
R2n
Jr2n . Rn
(13.24)
Descartes, c. 1649
= J2, r4 =
1; r2n
1
"2(rn
+ R n ),
R2n
Jrn . Rn
(13.25)
Gauss, 1809
Strictly speaking, the R2n and r2n converge towards the value ..jhn . 7r with
14 = 1/2; hn = In - %(R~n - r~n)' This results from the formula (7.1) on
page 87
185
Beginnings in India
The first series for 7f were noted down in India in the fifteenth century,
possibly even earlier. They are thus at least 100 years older than the
first European series (1593). This fact might have been known for 100
years, but the essay by Charles M. Whish on this subject dating from
the year 1835 On the Hindu quadrature of the circle and the infinite
series of the proportion of the circumference to the diameter exhibited
in the four Sastras, Tantra Sangraham, Yukti-Bhasa, Karana-Paddhati
and Sadratnamala was overlooked for 100 years. It was not until around
1940 that this essay resurfaced and its essentials were confirmed.
No less than eight 7f series are found in the Sanskrit texts YuktiBhasa and Yukti-Dipika, among them, for example, the two following
series, the first of which begins like the Leibniz series:
186
1
p-1
p/2
-~l--+---+"'=r----
p2+1
(13.26)
444
7r
= 3 + 33 _ 3 - 53 _ 5 + 73 - 7 - 93 - 9 + ...
(13.27)
All eight of the series are included in our collection of formulae, items
(16.6) to (16.13).
We are indebted to S. Parameswaran [89] and Rinjan Roy [98] for
making us aware of them. According to Parameswaran, the origins
of these series are complicated, especially as they were passed down
orally. The Yukti-Dipika was composed by Sankaran (c. 1500-1560),
who claims to have received directions from Jyestha-devan, who for
his part wrote down the Yukti- Bhasa. This contains detailed proofs
for the series as well as the series themselves. These two scholars in
turn received instruction in astronomy and mathematics from Kelallur Nilakantha Somayaji (c. 1444 - c. 1545) [sic!], the author of the
work Tantra Sangraham. If the series were not already composed, then
the latest person who could have written them is Nilakantha. Recent
research suggests that some of the series could actually have been formulated earlier and, in particular, some of them are linked with the
name of Madhavan, who lived from c. 1340 to 1425.
Even more surprising, if that is possible, than the great age of these
Indian series is the fact that they are quite simply better than the first
European series.
The author Nilakantha provided a residual sum along with the series (13.26). This gives an estimate of the order of magnitude of p-5.
(See formula (12.5)). As far as we know, Europe had to wait another
hundred years for an estimate that would be as accurate as this, until
Euler produced one in 1750.
The second series (13.27) is significantly better than the first
(13.26) as regards convergence. For example, the first series required
1010 terms to produce 10 correct decimal places of 7r, whereas the
second required fewer than 103 .
A third series (16.6) is even more convergent, in that 28 terms
produce as many as 16 accurate decimal places.
187
Infinite products
(13.28)
Viete, 1593
J~
i
1['
3 x 3 x 5 x 5 x 7 x 7 x 9 x 9 x 11 x 11 x 13 x 13 .. (13.29)
2 x 4 x 4 x 6 x 6 x 8 x 8 x 10 x 10 x 12 x 12 x 14 ..
Wallis, 1655
188
:;;: = 1 + ----3-;2:---
(13.30)
2+--~-
52
2+--2+ ...
Brouncker, 1658
The independent discoveries by Isaac Newton (1643-1727) and Gottfried Wilhelm Leibniz (1646-1716) of differential and integral calculus
in the second half of the 17th century heralded a boom in series formulae for 7r.
Some time in 1665-1666, Isaac Newton himself succumbed to the
temptation to calculate 7r with the aid of one of the new series. He used
his Method of Fluxions and Infinite Series to derive a quite effective
series for 7r (see (16.63)) which is essentially an expansion based on
the arcsin function. Using this, he obtained 15 digits of 7r (which, of
course, was no world record at that time). Newton later wrote, "I am
ashamed to tell you to how many figures I carried these computations,
having no other business at the time" [32, p. 339J. His words show only
too well the two minds which characterise many 7r "digit hunters" .
The date 15 February 1671 is of historical importance as the date
on which James Gregory (1638'1-1675) stated the first series for arctan
(without explaining how he derived it), in a letter [20, p. 89J. If r is
189
the radius, a the arc and t the associated tangens, then the Gregory
series reads as follows [114, p. 293]:
t3
a = t - 3r 2
t5
+ 5r4
t7
- 7r6
t9
+ 9r8
- ...
(13.31)
(13.32)
Gregory himself did not perform the easy step of substituting 1 for
x which leads to the so-called LeibnizSeries:
1["
1 1 1 1
4 = 1 - "3 + "5 - "7 + 9 - . . .
(13.33)
Leibniz derived this series independently of Gregory and cited it in
letters to several friends from 1674 onwards. In the meantime we know
that the same series was already known much earlier in India (see
page 185).
The first person to make use of the Gregory series to obtain an approximation for 1[" was the astronomer Abraham Sharp (1651~1742). In
for x and in this way discov(13.32) he substituted tan (1[" /6) =
ered a series (see (16.67)) which produces about 1 digit per 2 terms.
This he used in 1699 (almost 40 years after Gregory's invention) to
calculate 1[" relatively easily to 71 correct decimal places. This was the
very first world record that was not based on Archimedes's polygon
method.
Jl73
Leonhard Euler
190
including the one which is commonly rated as the most fascinating of all time, because it unites in one formulae 5 basic quantities of
mathematics:
1f,
(13.34)
You would not believe how much has already been said and written
about this formula! In the introduction we quoted the enthusiastic
words of Benjamin Peirce, but he was only one of many who have
marvelled effusively at the formula. Only a few years ago (1990) it
was voted the "most beautiful of all" by the readers of Mathematical
Intelligencer [120]4
Euler did not actually express "his" formula in this way but like
this (1743, in Miscellanea Berolinesia [41, p. 89]):
(13.35)
Euler, 1743
Rx =
(13.36)
Cotes, 1714
= -i In( -1)
(13.37)
Among Euler's most spectacular results in the 1f domain is his solution for the sum of the reciprocal perfect square roots, i.e. for the
. I1+1+1+
1 + .. '. M any great math
"
expreSSIOn
4'
9"
+ n7
ematIcIans,
4
In second place was another of Euler's formulae, namely that which defines the
relationship between the number of vertices (V), the number of edges (E) and
the number of faces (F) in a polyhedron: V - E + F = 2. in 14th place was an
Indian 1': series dating from the 15th century (16.10).
191
among them Leibniz and the brothers Jakob (1654~ 1705) and Johann
Bernoulli (1667~1748), had tried their hand at this apparently simple
exercise without success. Euler was the first one to succeed, in 1736,
in resolving this sum with the elegant expression,
00
1
k2
7f2
= "6 = 1.64493406. . .
(13.39)
k=l
sinx = 0
For sin x, he took the series that was already familiar to Newton
sinx = x - x 3/3! + x 5 /5! - x 7 /7! +...
(13.41)
6
2
4
= x (1 - x /3! + x /5! - x /7! + ... )
(13.42)
or, after substitution of y = x 2 ,
= x (1 - y/3! + y2/5! - y3/7!
+ ... )
(13.43)
II
127f2
(13.44)
If both sides are multiplied by 7f2, one obtains the sought-after solution
192
as many more beautiful identities. It would actually require a separate monograph to do justice to the wealth of Euler's discoveries on
7r. Nevertheless, a small selection of his pronouncements is included in
our collection of formulae on page 224ff.
Another of Euler's achievements was, as mentioned above, to make
the symbol 7r popular. Then, at the age of 72 in 1779, he began calculating 7r and arrived at 20 decimal places using an arctan formula he
had developed himself and a series of his own for the arctan function
(see page 74). This only took him an hour.
But Euler was not the only eighteenth century mathematician to
add to our collective knowledge of 7r. Already in the 15th century it was
suspected that 7r could not be a rational number, i.e. that it could not
be represented as a quotient of two integers. Huygens and Leibniz were
quite convinced of this. But it was not until 1766 that the Alsatian
mathematician Johann Heinrich Lambert (1728-1777) produced the
proof that 7r is irrational in [79], His proof begins with the statement
of an infinite continued fraction for tan v, which he expressed like this:
1
tan v = - - - - - - - - - = - 1 - - - - (13.45)
1: v 1
3: v 1
5:v-----7: v -l&c.
Lambert then demonstrated that the right-hand side of the equation must be irrational if v i= 0 is a rational number. But because
tan( 7r / 4) = 1 is rational, it follows that 7r / 4, and therefore also 7r
itself, must be irrational.
After Lambert, Legendre proved in 1794, that 7r 2 is also irrational.
Arctan formulae
193
111
1
arctan - = - - - 3 + - 5 -...
(13.47)
x
x
3x
5x
For the first arctan expression with x = 5 he had to calculate
around 70 terms in the series (13.47), but for the second expression
with x = 239 he only needed 20 terms.
John Machin did not publish his famous achievement himself; his
(1 + 100)-digit 7r and his arctan formula appeared in William Jones's
previously mentioned work, the Synopsis Palmariorum Mathesos[68],
in which the symbol7r was also proposed for the first time. In this way,
this work by a self-made mathematician contains two major innovations regarding 7r.
For more than 200 years afterwards no one came up with a better method of calculating 7r than to use combined arctan formulae.
However, mathematicians soon learned how to construct other such
relations after the model of Machin's formula which might offer scope
for optimisation. C.F. Gauss (1777-1855) developed some especially effective variants. Thus it came about that the arctan method remained
in use for more than 250 years until 1970, although of course this is far
short of the life of Archimedes's method. Even the early computer calculations almost exclusively made use of arctan formulae, and one of
those used most frequently was actually the good old Machin formula
(5.20).
After Machin many other mathematicians took up the task, and
every few years a new 7r world record would be set. But as the number of decimal places grew, so too did the risk of making a mistake.
Thus we hear of several instances of calculation errors which in each
case were revealed inevitably the next time the record was beaten. For
example, although Fautet De Lagny (1660-1734) discovered 27 digits
more than Machin in 1719, it turned out when the world record was
next beaten by Vega (1754-1802), that his 112th decimal place was
incorrect. However, as this was the only incorrect digit, it seems likely
that it was a case of a transcription error rather than that the calculation itself was at fault. Vega himself also made a mistake - of the
143 digits he produced in 1789, only 126 were correct. Five years later
Vega improved on his own record with a 7r that was 140 digits long,
but the last four of these were also incorrect.
Even today, the last digits calculated are always the most suspect.
The current world record holder Yasumasa Kanada cut off 200 digits
from his 206.1 billion 7r digits to be on the safe side, although his
194
7f
test calculation only differed from the actual calculation in the last 45
digits. No doubt he thought there were enough digits anyway.
Euler too was a victim of De Lagny's error, as he reproduced De
Lagny's number in his Intmductio. Since then, publishers thinking of
issuing a new edition of this important and interesting work have been
faced with the dilemma as to whether they should simply correct the
error or transfer it for the sake of historical truth. A recent English
edition dating from 1988 chose the latter approach [52, p. 101], while
an older German edition published in 1885 [53, p. 95] decided on the
first approach.
In the 18th century, important mathematicians were also at work
on 7r in Japan, although they remained behind their European counterparts. in 1722 Takebe Kenko (1664-1739) obtained 41 decimal places
for 7r 2 using a series for 7r 2 (16.86), while in 1739 Matsunaga obtained
50 decimal places. Thereafter, according to Beckmann [18, p. 102]' the
Japanese seem to have had more sense than their European colleagues;
they continued to study series yielding 7r, but wasted no more time on
digit hunting. Today Beckmann would not be able to say this, as in
recent years no one has pursued the hunt for 7r digits more vigorously
than the Japanese Yasumasu Kanada and his team.
The Austrian mathematician Lutz von Strassnitzky (1803-1852)
exploited an unusual opportunity which came his way. in 1840, the
"famous mental computer" Zacharias Dase (182(}-1861) visited him
in Vienna and attended his lectures on elementary mathematics. As
he was whiling away the time with the "most colossal, but pointless
calculations" , Strassnitzky persuaded him to do perform some research
which "at least he would be able to use" , namely the calculation of 7r
to 200 decimal places. Among the formulae it was suggested he should
use, Dase chose the following arctan formula which does not converge
as well as Machin's formula but is well suited for paper and pencil
(and rubber!) [112]:
1
1
1
1
-47r = arctan - + arctan - + arctan (13.48)
258
In under two months Dase had finished. Dase's 200 decimal places were
8 fewer than William Rutherford had achieved twenty years earlier, but
they were still a world record as only 152 of Rutherford's digits were
actually correct.
Dase was known throughout Germany for his calculation skills. He
was able, for example, to multiply two 8-digit numbers in his head
195
196
7r
imal places. The accuracy was further vitiated by a blunder committed by Shanks in correcting his copy prior to publication, with the
result that similar errors appear in decimal places 460-462 and 513515. These errors persist in Shanks's first paper of 1873 containing
the extension to 707 decimals of his earlier approximation. His second paper of that year, which contained his final approximation to 7f
(of 707 decimals), gives corrections of these errors; however, there appears an inadvertent typographical error in the 326th decimal place of
his final value. In retrospect, we now realize that Shanks's first value
(530 decimal places) published in 1853 was the most accurate he ever
published." [122]
The error in the 528th digit of Shanks's various 7r calculations remained unproven for many years. The person who got the furthest to
checking it was Richter in 1854; however the latter did arrive at the
wrong decimals. It was not until 1946, 90 years after Shanks, that the
error was demonstrated by Daniel Ferguson, incidentally in what may
have been the last 7f calculation to have been undertaken by hand.
However, Shanks's 7r had been suspected of being incorrect much
earlier. The first person who became suspicious about the accuracy of
Shanks's 7r was the mathematician Augustus de Morgan (1806-1871),
a severe critic of the would-be circle squarer and inventor of the morbus cyclometricus, defined as the circle-squaring disease. He counted
the frequency of every digit occurring in the 607 decimal version of
Shanks's number and concluded from the deficiency of 7's that Shanks
must have made a mistake. Unfortunately he was right.
This was all very sad as it only went to show how unfair the world
can be: a person can sweat away at his labours for years only to have
someone else glance at the results and show that they are wrong in a
matter of an hour.
As the 19th century came towards its close, there was a major
new breakthrough on 7r research. What had already been clear to
mathematical scholars such as Michael Stifel (1487-1567) in the 16th
century became certain fact in 1882, when it was established beyond
doubt that 7r is not only irrational but also transcendental. Stated formally this means that 7r cannot be the root of any algebraic equation
containing only rational coefficients. A corollary of this is that it is
not possible to square the circle with a compass and straight edge.
Proof of this was certainly in the air by 1873, when Charles Hermite
(1822-1901) proved the transcendence of e. Decisive proof that 7r too
197
198
Even though computers were becoming more powerful, the calculation of still more decimal places would have run into insurmountable
obstacles at some point. Daniel Shanks, whom we mentioned above,
still believed in 1961 that no one would ever succeed in calculating
more than 1 million 7r digits. Castellanos [41] commented on this statement by quoting the Chinese saying that it is dangerous to make predictions especially when they refer to the future.
The Chinese saying did not stop Peter Borwein predicting in a
lecture in 1995 that we would never discover the 1051 th digit of 7r.
Even if 1051 is a very big number and Peter Borwein an extremely
distinguished 7r researcher, this is a bold statement indeed.
Fast multiplication
The first of these occurred in 1965 when the process of multiplying
two (long) numbers was speeded up dramatically and to a certain extent out of proportion and the old "school multiplication" approach
was superseded. Under the new method, known as fast Fourier transform (FFT) multiplication, the two multiplicands are first "Fourier"transformed; they are then subjected to an pointwise multiplication
process which can be executed in linear time, and finally the vector
product is transformed back again. The critical factor in this multiplication process is the fact that the three Fourier transforms can
be executed very quickly, i.e. at a rate better than quadratically (see
pages 135ff.).
The discovery of this multiplication algorithm came more or less
by chance:
"During a session of the scientific advisory committee of the American President [Lyndon B. Johnson in 1964] Richard W. Garwin established that John W. Tukey, who was one of the attendees, was trying
199
to develop some programs for the Fourier transform 5 . Garwin ... asked
... and Tukey provided an outline of what was later to be the famous
Cooley-Tukey algorithm."
It just goes to show how a President has his uses!
"Garwin went to the computer centre of the IBM research centre in
Yorktown Heights to have the procedure programmed. James W. Cooley had not been working at the IBM research centre for long and, in
his own words, was entrusted with the assignment because he was the
only one who did not have anything important to do ... " [38, p. 8].
It was only a short while after publication of the Cooley-Tukey
algorithm that the search for historical sources began. Someone who
read their paper described an earlier program of his own with similar
performance and attributed it to a method by G.C. Danielson and
C. Lanczos dating from 1942. The authors for their part referenced
essays by C. Runge and H. Koenig dating from the years 1903 and
1924 [44]. But these were not the earliest attempts at using FFT. It
seems that once again it was C.F. Gauss who was the first to have
had the all-important idea of speeding up the Fourier transform and
in fact he did so 100 years (1805) before anyone else [65].
The time required for school multiplication is of quadratic order,
whereas FFT multiplication, of which there are today many variants,
only requires the order of N log2 N (see page 140). With FFT multiplication, the time it takes to multiply n-digit multiplicands does not
increase much more quickly than n itself.
1r-specific algorithms
Moreover, John Tukey is the inventor of the word "bit", short for binary digit,
in 1946, and he also seems to be responsible for introducing the term "software"
in the sense as it is used today, in 1958 ("The Economist" June 3rd 2000, p. 96)
200
7r
.!. = vIS
7f
(13.49)
A second significant discovery in this area was the Gauss AGM algorithm. It consists of an iteration method such that, when executed,
the number of correct 7f digits is doubled during each iteration stage,
thus converging quadratically on 7f. In this way, for example, the first 9
iterations produce successively 1, 4, 9, 20, 42, 85, 173,347 and 697 correct digits of 7f [13, p. 53].
This algorithm was independently discovered in 1976 by Eugene
Salamin and Richard Brent. But the underlying formula had already
been discovered 170 years earlier by the German mathematician Carl
Friedrich Gauss (see Chapter 7). Salamin at least was aware of the
origin of the algorithm when he published it.
In 1985, the Borwein brothers added to the stock of 7f-specific highperformance algorithms when they published iteration procedures in
the style of the Gaussian AGM algorithm which converge at a rate
better than quadratically. Thus, in the "quartic Borwein iteration" four
times as many correct digits are produced during each iterative step
so that in 1999 the present world record holder, Yasumasa Kanada,
only needed twenty iterations to calculate 206.1 billion digits of 7f.
The Borweins derived their method from the same theory of modular
functions which had also led Ramanujan to his series.
It was thanks to these discoveries that, in an unprecedented boom
spanning the 19 years from 1981 to 1999, the 7f world record was
bettered a total of 26 times, often by more than double the previous
record, from 2 million to currently 206.1 billion digits. Our table on
page 206 lists the individual landmarks.
The new
1T'
digit hunters
It is striking that 18 out of the 39 world records are linked with the
name Yasumasa Kanada (the stress falls on the second syllable). This
man is Research Adviser in the Department of Science at Tokyo University. He heads a laboratory, Kanada laboratory, which specialises
amongst other things in "high performance computing". To perform
201
202
7r
with the position from where he had taken them. He asked the brothers
to send him an analogous section from their 1f calculation for verification purposes. But the Chudnovsky brothers have never responded.
The only others to have held a world record since 1981 apart from
Kanada or the Chudnovsky brothers are Gosper and Bailey.
As mentioned above, Gosper calculated 17 million decimal places
in 1985, using the Ramanujan series (13.49). His computer was not a
supercomputer but a comparatively simple Symbolics 3670 workstation which, however, compared with conventional computers, has the
advantage of unlimited arithmetical precision. When announcing his
record, Gosper stressed the fact that he had not calculated simple decimal places but more sophisticated continued fraction places. His sequence thus did not begin with 3,1,4,1,5, but with 3,7,15,1,292. Gosper
hoped to attain a deeper understanding of the nature of the number 1f
by adopting this representation form, since for number theoreticians a
continued fraction is definitely a more informative alternative. Sadly
the continued fraction did not reward the effort of his calculations
but only suggested "normal probability" (see also Chapter 04 on this
point). Nevertheless, the calculation did confirm that the continued
fraction of 1f does not follow any model, which is actually a useful
piece of information, since, for example, the numbers e, v'2 or J3 do
follow a model.
To crown it all, Gosper ended up having to convert his continued
fraction to the decimal form solely in order to be able to check it.
David Bailey is a scientist at the NASA Ames Research Center in
California, USA. He has published extensively on high-performance
calculations and is one of the authors of the BBP algorithm. Between
7 and 9 January 1986 in a total of 28 hours he calculated 1f to 29 million decimal places and wrote a fine essay about it [9J. In the essay he
states amongst other things that the main purpose of his calculation
was to test the hardware (of a Cray-2 supercomputer), the operating
system and the compiler. He wrote his calculation program in FORTRAN because the compiler for that programming language was able
to exploit the vector processor properties of the Cray particularly well.
The actual calculation required 12 iterations of the quartic Borwein
algorithm and checking it required 24 iterations of the quadratic Borwein algorithm. The report also contains statistics on the frequencies
of different numbers, but these do not produce any striking results.
11"
iT
digits
203
digits
http://www-stud.enst.fr/-bellard/
http://www.cecm.sfu.ca/projects/pihex/announcelq.html
204
7r
Who?
Babylonians
Egyptians
Indians
Bible
Plato
Archimedes
Zhang Heng
Ptolemy
Wang Fan
Liu Hui
Tsu Chhung-Chih
When 7
20007 BC
2000? BC
6007 BC
4407 BC
c. 380 BC
c. 250 BC
c. 130 AD
150
c.250
263
c.480
No. of
decimals
1
1
0
0
2
2
1
3
1
5
7
6
3
1
3
3
3
16
9
9
15
20
35
34
39
15
71
100
111
50
136
152
200
248
261
530
530
620
710
808
1,120
Algorithm 1
3+ 1/8
4 (8/9)2
4 (9785/11136?
11'=3
V2+v'3
pgm(96)
v'lO
205
Comment
3
2;1
377/120
142/45
pgm(192)
pgm(12288)
11' -- 355
113
Aryabhata
499
pg(384)
Brahmagupta
6407
v'lO
Alkarism
830
62832/20000
Fibonacci
1220
864/275
Dante
c. 1320
3+ V2/1O
AI-Khashi
1430
pgm(3.2 28 )
211'
Nilakantha
c. 1501
104348/33215
Viete
1579
pgm(32 17 )
pgm(220)
Romanus
1593
Ludolph Van Ceulen
1596
pgm(15 . 235 )
pgm(262)
Ludolph Van Ceulen
1615
Snell
1621
pgm(23O )
Grienberger
1630
last use of p'gons
pgmO
Newton
1665
N
first use of series
Sharp
1699
G
Machin
1706
M
De Lagny
1719
G
127 total
Matsunaga
1739
H
Vega
1794
E
140 total
Rutherford
1824
E
208 total
Dase
1844
S
Clausen
1847
M
Lehmann
1853
H
W. Shanks
1853
M
Ferguson
1945
L
Ferguson
1946
L
last hand calc'ion
Ferguson
1947.01
L
desk calculator
Ferguson, Wrench
1948.01
M
Smith, Wrench
1949.06
M
1 pgm(x) = Polygons with x sides.
Series: E=Euler (5.25), G=Gregory (5.3), H=Hutton (5.17), L=Loney (5.18),
M=Machin (5.20), N=Newton (16.63), S=Strassnitzky (16.108),
Table 13.1. History of 11' in the pre-computer era
206
Who7
Time Computer
Reitwiesner
1949.09
2,037 M
70 h ENIAC
Nicholson, Jeenel
3,092 M
1954.11
0:13 h NORC
Felton
7,480 K
1957
33 h Pegasus
Genuys
1958.01
10,000 M
1:40 h IBM 704
Felton
1958.05
10,020 K
33 h Pegasus
Guilloud
1959
16,167 M
4:18 h IBM 704
8hanks, Wrench
1961.07
100,265 8
8:43 h IBM 7090
Guilloud, Filliatre
1966.02
250,000 G
41:55 h IBM 7030
Guilloud, Dichampt 1967.02
500,000 G
28:10 h CDC 6600
Guilloud, Boyer
1,001,250 G
1973
23:18 h
Miyoshi, Kanada
1981
2,000,036 K
137:18 h FACOM
Guilloud
2,000,050
1981-82
Tamura
1982
2,097,144 G2
7:14 h MELCOLM
Tamura, Kanada
1982
4,194,288 G2
2:21 h HIT M-280H
Tamura, Kanada
1982
8,388,576 G2
6:52 h HIT M-280H
Kanada, Yoshino,
Tamura
1982
16,777,206 G2
< 30 h HIT M-280H
Gosper
1985.10
17,526,200 R
8ymbolics 3670
Bailey
1986.01
29,360,111 B4
28 h CRAY-2
Kanada, Tamura
1986.09
33,554,414 G2
6:36 h HIT 8-810/20
Kanada, Tamura
1986.10
67,108,839 G2
23 h HIT 8-810/20
Kanada et al.
1987.01
134,217,700 G2
35:15 h NEC 8X-2
Kanada, Tamura
1988.01
201,326,551 G2
5:57 h 8-820
Chudnovsky's
1989.05
480,000,000 7 C
:::::: 6 mon CRAY-2
Chudnovsky's
1989.06
525,229,270 C
> 1 mon7 IBM-3090
Kanada, Tamura
1989.07
536,870,898 G2
67:13 h HIT 8-820/80
Chudnovsky's
1989.08 1,011,196,6917 C > 2 mon 7 IBM-3090
Kanada, Tamura
1989.11
1,073,741,799 G2
74:30 h HIT 8-820/80
Chudnovsky's
1991.08 2,260,000,0007 C
250 h 7 m-zero
Chudnovsky's
1994.05 4,044,000,0007 C
unknown unknown
Takahashi, Kanada 1995.06
3,221,225,466 B4
36:52 h HIT 8-3800
Takahashi, Kanada 1995.08
4,294,967,286 B4
113:41 h HIT 8-3800
Takahashi, Kanada 1995.10
6,442,450,938 B4
116:38 h HIT 8-3800
Chudnovsky's
1996.03
8,000,000,000 C
unknown 1 week 7
Takahashi, Kanada 1997.04 17,179,869,142 G2
5:11 h HIT 8R2201
Takahashi, Kanada 1997.05 34,359,738,327 B4
15:19 h HIT 8R2201
Takahashi, Kanada 1997.07 51,539,607,510 B4
29:03 h HIT 8R2201
Takahashi, Kanada 1999.04 68,719,470,000 B4
32:54 h HIT 8R8000
Takahashi, Kanada 1999.09 206,158,430,000 G2
37:21 h HIT 8R8000
IT 8eries: M=Machin (5.20), G=Gauss (5.22), K=Klingenstierna (5.21),
8=8t0rmer (5.19), R=Ramamanujan (13.49), C=Chudnovsky (8.7).
Iterations: G2=Gauss AGM (alg 7.5), B4=Borwein quartic (alg 9.2)
Table 13.2. History of
7r
Who?
Bailey,
P. Borwein,
Plouffe
Bellard
Bellard
Percival
Percival
Percival
When?
1995.09
1996.10
1997.09
1998.08
1999.02
2000.09
Hexadecimal
Position
lO lD
1011
2.5.10 11
1.25. 10 12
10.10 12
250.10 12
1r
digits
Formula
Hexadecimal
Sequence
BBP (10.1)
Bellard (10.8)
Bellard (10.8)
Bellard (10.8)
Bellard (10.8)
Bellard (10.8)
921C73C683
9C381872D2
87F72B1DC9
07E45733CC
AOF9FF371D
E6216B069C
...
...
...
...
...
...
207
210
with diameter 250 has 20 sides of length 25V2 and 8 sides of length
3V2y'5, and the approximation is now 3.13200 ....
It will be seen that every time the radius is increased by a factor
of 5, 8 new vertices occur whose co-ordinates are integersl; even more
important for calculation purposes is the fact that all the side lengths
of the resulting 36-, 44- etc. sided polygons can be expressed solely
using square roots of 2 and/or 5. This captivatingly simple procedure,
which would doubtless have thrilled Pythagoras, was discovered by
Franz Gnaedinger of Zurich [59J; the complete proof was contributed
by Christoph Poeppe. In arriving at this discovery, Gnadinger identified additional simple geometric constructions for the formation of the
vertex co-ordinates and also devised simple methods to approximate
the square roots from 2 and 5 to any degree of accuracy. For the roots
from 2, for example, he specifies the following number stack, whose
construction rule is easy to guess:
1
1
2
2
4
3
5
10
7
12
17
29
24
41
70
58
99
140
The fractions 10/7 and 7/5 are simple approximations for V2. 24/17
and 17/12 are better approximations, and 140/99 and 99/70 are already very good approximations for V2.
Now Franz Gnadinger is first and foremost an Egyptologist, and so
he looked to see whether the good old Egyptians (who of course were
very young in the pharaonic era, due to their low life expectancy, and
looked at the world with just the same curiosity that young people do
today) had known of this method. His conclusion is that they probably
did.
To start with, the Egyptians had a motive for measuring circles.
The hieroglyph for the sun god Re was a circle. If one could only
understand the circle and fathom its secret number, one would be able
to share in the power of Re.
1
= 3Y2k - 4X2k,
Y2k+l = 4Y2k + 3X2k
= 4Y2k+l - 3X2k+l, Y2k+2 = 3Y2k+l + 4X2k+l
14.2 A
7r
law
211
But the Egyptians were also quite precocious in mathematical matters. They already knew about Pythagorean triangles (right-angled
triangles whose side lengths are integers), the simplest of which have
side lengths which are multiples of 3, 4 and 5 and were referred to by
the Egyptians as "holy triangles" .
According to Gnadinger, all the elements of a method for approximating 7r and even the most important numbers are to be found in
King Zoser's funerary complex at Saqqara, in the Cheops pyramid and
the Chephren pyramid, for example:
Gnadinger is especially interested in the visionary architectural genius Imhotep, who c. 2600 BC designed the monumental and graceful step pyramid at Saqqara near the former Memphis, to the fame
and eternal life of Pharaoh Zoser. Gniidinger cites other Egyptologists
in support of his view that this Imhotep could well have developed
extremely good approximations for 7r based on the above procedure
and the rational approximations for the roots of 2 and 5 which have
been handed down. After just two iterations, with irregular 20-sided
polygons, he would have arrived in systematic manner at the approximation 7r ~ 3.128 ... , which is significantly better than the value of
(~6? = 3.160 ... which is found in the Rhind Papyrus of 1850 BC
and was probably discovered empirically (see page 167). This more
accurate version of 7r would have been more than 700 years older.
14.2 A
1T'
law
100 years ago a law prescribing the value 3.2 for 7r was very nearly
passed in the state of Indiana, USA. The story is no doubt mainly
amusing to Americans, perhaps because the event took place on American soil and in any case everything turned out well in the end, or
perhaps another reason why they like it could be that a former, less
popular vice-president came from Indiana.
212
The magazine had actually existed earlier but under the name of "Ladies Diary" .
213
the shortcomings of the Bill to the senators, who placed all further
readings of the Bill on hold, and the matter was permanently laid to
rest.
One of the historians recounting this event, David Singmaster, felt
that Goodwin was due particular credit as one of only very few "circle
squarers" to have possessed several values for 7r [110]. The mean value
of all the 7r'S which Goodwin served up in articles, interviews and in
the above draft Bill, was calculated by Singmaster at 3.28907.
This story even appeared in the German newspaper "Die ZEIT"
(1997/28,4 July 1997). There it appeared with the following comment:
"Before we laugh too loudly at the legislature of Indiana or at the
general ignorance which prevailed in 1897, we should pause a moment
and reflect on what fate the draft Bill would have met, had it been the
subject of a referendum today.
214
A people which has seen how alien desires for dominion are gnawing
at its identity, how enemies of the people are working to impose their
alien ways on it, must reject teachers of a type alien to it."
The English mathematician Godfrey H. Hardy, whom we encountered earlier as S. Ramanujan's patron (see page 106), responded to
Bieberbach in these words [109]:
"There are many of us, many Englishmen and many Germans,
who said things during the (First) War which we scarcely meant and
are sorry to remember now. Anxiety for one's own position, dread
of falling behind the rising torrent of folly, determination at all costs
not to be outdone, may be natural if not particularly heroic excuses.
Prof. Bieberbach's reputation excludes such explanations of his utterances; and I find myself driven to the more uncharitable conclusion
that he really believes them true."
7r
216
7r
a-I
:= 1.) Hence,
N-I
L ak =: ro (1 +
rl
(1
k=O
N ow we define
rm,n := rm (1
where
m <n
(15.3)
(15.4 )
Then,
(15.5)
(No need to believe it, just work it out!)
In particular,
n
ro,n
(15.6)
= Lak
k=O
(15.7)
= rm,x +
II rk . rx+l,n
(15.8)
k=m
hence
(15.9)
(where m ::; x < n). All the terms listed here are rational numbers,
and therefore consist of two integers.
In this way we can formulate the binsplit algorithm by simply specifying a recursive binsplit function:
rational function r (rational function a, int m, int n)
{
rational ret;
if m==n then
{
ret := a(m)/a(m-1)
}
else
{
x := floor( (m+n)/2 )
ret
;=
217
return ret
}
Here, a (k) is a function which returns the kth term of the series to
be summed. As an example let us take arctan(l/lO):
function a(int k)
{
if k<O then
else
return 1
return (-1)-k/((2*k+l)*10-(2*k+l))
__
rO,7
--------~A_--------~
TO,3
__----A"------,
r_----~A"------,
rO,1
~
TO,O
TI,1
r2,2
r3,3
T4,4
T5,5
T6,6
r7,7
__
+ 4~~8:55070~~010~0~3~030~d"0
. . --------------_
------------~A
20930417
4964393497
643500000000
+ 210000000
-417
70000
+299
3000
-7637
990000
__---A....---.
+-lo
3
- 500
7
-900
1
- 300
9
-1100
-16357
1950000
_--A. . .--_
-
11
1300
13
-1500
Instead of the realistic Nlog(N) log(log(N)), which can be achieved with the best
known multiplication method, namely the SchCinhage-Strassen method [104].
218
7r
if j<O then
else
return (-1)-k/2*k+l)*10-(2*k+l))
return (-1)-(k-j)*(2*j+l)/(2*k+l)/10-(2*(k-j)
rational ret;
if m==n then
{
ret := a(m,m-l)
}
else
{
x := floor( (m+n)/2 )
ret := r(a,m,x) + a(x,m-l) * r(a,x+l,n)
}
return ret
}
15.2 The
rO,2N-l
rO,N-l
7f
+ aN-I' rN,2N-l
219
(15.10)
15.2 The
7r
These are fast Fourier transform (FFT) algorithms which can handle data volumes larger than the RAM storage available; they work with files on the hard
disk.
220
7r
u; + dv;
--:=----=..:.--,;,;:,
Vn+l
2un
(15.11)
Vn
15.2 The
7r
221
16.
Formula Collection
7r
circumference
diameter
1T
(16.1)
area of circle
(16.2)
1T
= radius of circle 2
= 4 arctan 1
1T
1T
1T
(16.3)
(16.4)
(16.5)
-iln(-l)
= v'i2 (1 _ _1_ +
3.3 1
_1_ _ _
1_ + _1__ ... )
5 . 32
7.33
9.3 4
(16.6)
p/2
1 p2+1
where p is the last odd denominator + 1
1
1T
4'::::d-:3+5-'7+"''f p -
(16.7)
1T
4' ~
1-
:3 + 5 - '7 +
...
'f
1
7+1
p - 1 ~ (p2 + 4p + 1)
(16.8)
1
1
1
1
16 = 15 + 4 . 1 - 3 5 + 4 . 3 + 55 + 4 . 5 - 75 + 4 . 7 + ...
1T
(16.9)
4
4
4
4
3 + 33 _ 3 - 53 _ 5 + 73 _ 7 - 93 - 9 + ...
(16.10)
444
~ 2 + 22 _ 1 - 42 _ 1 + 6 2 _ 1 -
- ... 'f
p2 _ 1 2(p + 1)2 + 4
(16.11)
224
16.
7r
"8 =
Formula Collection
7r
1
22 - 1
+ 62 -
+ 102 -
+ 142 -
+ 182 -
(16.12)
+ ...
7r
'2 -
(16.13)
iTr
= -lor:
7r
-iln(-I) or:
eTr
2i
(16.14)
Euler, 1743
= 1 +x x2
arctan x
1+
3'2
X2
1 + x2
+ 23 .. 45
X2
1 + x2
) 2
+ ...)
(16.15)
Euler, 1755
7r
28
10
30336 [
+ 100000
1+
3.5
2 (
3'
100
144)
100000
24 (
+ 35
144 )
100000
+ ...
(16.16)
7r=41
~dx
(16.17)
Euler, 1738
26
7r
-5-
dx
io
(16.18)
V1- X4
Euler, 1739
7r
= 4
dx
f01
io VI -
X4
x dx
io VI -
(16.19)
X4
Euler, 1748
7r
= n-+oo
lim - 2
n
~
~
Jn
k2
(16.20)
k=O
Euler, 1738
7r
. [1 + - 1 + (1+
lIm
n-->oo
4n
6n 2
-2 - n
12
1 )]
+- - + ... + -n 2 + 22
n2 + n Z
(16.21)
3\1'3 (1 _ .!:.
2
(16.22)
Euler, 1739
1i =
00
7r
(16.23)
16.
1(
1
7r 2 =
1
1
1
1 - 22 - 32 - 52
1
+ (27)2 +
1
- 232
+ (2.3)2
Formula Collection
1
+ (2.5)2
1
1
1
1
(35)2 -172 - 19 2 + (37)2
1
1
(2 13)2 - 29 2
1
- 72
7r
225
1
1
- 112 - 132 + (16.24)
1
(211)2
1
)
(2 3 . 5)2 - ...
(16.25)
(16.26)
Euler, 1737
(16.27)
Euler, 1736
7r 2
32
22
6
2
7r
8 =
22 - 1 . 32 - 1 . 52 - 1 . 72 - 1 ...
(16.28)
1
}2
(16.29)
+ 32 + 52 + 72 ...
Euler, 1748
(16.30)
Euler, 1748
32
53
(16.31)
Euler, 1748
4
7r
4
90
7r
=
=
9
680
00
(16.32)
k4 (2k)
k=l
Euler, 1738
1
14
(16.33)
+ 24 + 34 + ...
Euler, 1748
4
96
7r
(16.34)
= 1 + 34 + 54 + 74 + ...
Euler, 1748
(16.35)
Euler, 1748
26
7r
1
27! ( 1
76977927 224 126
(16.36)
Euler, 1738
7r
= ~ + 4n (
n
+ B2
__
1_
n2
+ 12
B6
+ __
1_ + ... + __
1_)
n 2 + 22
n2 +n2
+ BlO
B14
~+
e 21l'n
3. 22 . n 6
5.24 . n lO
7.26 . n14 + . . .
(16.37)
where the B; are the Bernoulli numbers: B2 = 1/6, B6 = 1/42 ...
n2
(16.38)
Euler, 1748
226
16.
Formula Collection
1l'
1l'
11
13
17
19
(16.39)
1 2 6 12 20 30 42
-=1+- 1+1+1+1+1+1+1+ ..
2
1l'
(16.40)
Euler. 1739
3
-7r
4
1 3 8 15 24
- 2+2+2+2+2+ ..
= 2+ -
(16.41)
Euler, 1739
Sin 7rZ
7r
IT (1 - ~:)
(16.42)
k=1
For
Euler, 1735
7r
- . - = r(z)r(1- z)
z real, non-integer
sm 7rZ
Io eOO
(16.43)
where rex) :=
t - dt for all real x > 0
Euler's Gamma function
X
;: =
(2n) 3 42n + 5
L=
n=O
(16.44)
212nH
7r
(16.45)
= vI8
7r
9801
f;:a (n!)4
(16.46)
396 4n
~2 = 1 +
! (!)
2
+ 13
24
(!)
5
~
246
(!)
7
+ ...
(16.47)
V"2
7re
1 + 1 3 + ~ + 1 35 7 + ... +
1 1 234
+- - - - 1+1+1+1+1+ ..
Ramanujan [41, p. 89]
(16.48)
16.
7r
"2 In 2 =
3
48
7r
1
1 + "2
13
Ramanujan
[41. (8-2)J
7r
. 32 + 2.4
1
. 52
135
1
. 72
+ 2.4.6
1.3
Ramanujan
[41, (8-3)]
7r
Formula Collection
+ .. .
1.3 .5
227
(16.49)
1
. 73
+ ...
(16.50)
BBP-like series
(_I)n
~~
00
7r
(2+
4n
=~
00
7r
1 (4+
16n
8n
1)
1997
[2]
1)
1
26
(2
- 4n + 1 -
(-1
210n
~
00
1
4n + 3
2
8
= ~ -.!.. (
~ n3
n=1
7r
=~
-.!..
~ n3
n=l
1)
+ IOn + 9
-12
n +1
Adamchik and
(16.53)
+ IOn + 1 +
26
22
22
- IOn + 3 - IOn + 5 - IOn + 7
Bellard, 1996 [19]
7r 2
(16.52)
1 - 8n + 4 - 8n + 5 - 8n + 6
7r
(16.51 )
+ 4n + 2 + 4n + 3
(-238
n+1
+
+
(16.54)
+ 35625/32)
(16.55)
4n+5
Adamchik and Wagon,
7r
1
226
00
1997 [2J
(-1
(227
230n
20n + 1
222
6n+l
2 15
+---
220
60n+15
212
2 25
12n + 1
2 19
IOn+3
212
225
IOn + 1
2 18
20n+7
2 10
224
+ 20n + 3 +
2 15
12n+5
29
------------+
+ 12n+ 11
Pschill, 1999
1)
+ 12n+ 19
(16.56)
228
16.
7r
7r
Formula Collection
2=1(3
1)
4n + 1 - 4n + 3
= v'3 ~ gn
or, general:
2
7r
(_I)jn
00
(j
(16.57)
(_I)I-1 3j
-l) .>
,J
2,3,4 ...
(16.58)
Pschill, 1999
Other series
(16.59)
Leibniz, 1674
7r
7r
1111
= 2V2 ( 1 + 1
3" - 5 - "7 + "9 + 11
=
}~~
+ + ... )
(16.60)
22n
- -
c:) .:; :
(16.61)
(16.62)
Bauer [17], converges a lot better
7r
= 24
v'3 t/4
( 32 + 10
3V3
=4
+ 24
Jx - x 2 dx
( 1
1
12 - 5. 25
(16.63)
28 . 27 - 72 . 29
1)
~ 3 . 5 ... (2k - 3)
- ~ 4 . 6 ... (2k) . (2k + 3) 22k+ 3
(16.64)
'6
arCS1ll
(16.65)
13
= 2 + 2 . 3 . 23 + 2 . 4
1
. 5 25
135
1
2 . 4 . 6 . 7 27
+ ...
(16.66)
Newton, 1676
V3
7r
- = arctan6
3
V; (
1 - 3\
(16.67)
+ 3/' 5 -
31
3 .7
3/ 9 -
.. .)
(16.68)
= 16v'3 (_1_
+ 5 . 72. 33 + 9 . 113 . 3 5 + ... )
1 .3 .3
Used by De Lagny in 1719
(16.69)
16.
L
oo
7r
- - 1+
2 -
8=0
7r
Formula Collection
2 . 4 . 6 ... 28
1
.3 . 5 . 7 ... (28+1) 2 8
229
(16.70)
(In 2?
~ 1
12 - - 2 - + L 82
7r
(16.71)
28
8=1
7r
(Si:X)
x=-oo
7r
+00 (.Sl:X
= L
(16.72)
)2
(16.73)
x=-oo
(16.74)
(16.75)
(16.76)
Catalan, 1948 [41, p. 86J
1
7r
= 3+ 6
(00 (_I)n+l)
~ L~=1 k2
(16.77)
7r
740025
where
(00
3P(n))
~ G~) 2
n- 1
pen)
(16.78)
20379280
885673181 n 5 + 3125347237n 4
:= -
- 2942969225 n + 1031962795 n
- 196882274n + 10996648
3
00 n!22 n+ 1
7r = ~ (2n+ I)!
7r
(16.79)
1
234
2+ -(2+ -(2+ -(2+ -(2+ ".))))
(16.80)
,,)))) (16.81)
Gosper
7r
n=O
(25n - 3)n!(2n)!
2n-l(3n)!
Gosper, 1974
(16.82)
230
16.
Formula Collection
7r
297 =
( 1
25 ~ ben)
7r=
n2
(n
1)
(16.83)
+ 1)2
7r
= 1
3J3~ ne:)
(16.84)
Comtet, 1974
7r
18
n=l
Euler, 1748
2 _
7r
(16.85)
n2(2n)
n
2n 1
+ (n!)2]
4 1 + ~ (2n
[
(16.86)
+ 2)!
7r 2
= 72 ~ (2 - v'3t
L
n2(2n)
n=l
(16.87)
4
7r
3240 ~
(16.88)
= 17 L n4(2n)
n=l
Comtet, 1974
! =
7r
12
~(_I)k (6k)! 13591409 + 545140l34k
)640320 3
(k!)3(3k)!
(640320 3)k
t:o
(16.89)
Products
(16.90)
Viete, 1593
:;;: =
=
11
= (
33 55 77
24 . 46 . 68 . . .
1)
1 + 4n(n + 1)
13 35 57 79
2 . 2 . 2 . 4. 4 . 6 . 6 . 8 . 8 . . .
00
211
(16.91)
1)
1 - 4n 2
(16.92)
WaIlis, 1655
:;;: =
II
n=l
VI
fl
2 + 2 2 + 2 2 + ... + 2 V2 x
(n radicals)
Osler[88], 1999
II= 2 2P+1n'
+ n - 1 2 + n +1
2P+1n
P
n=l
(16.93)
err = 32
II (a~+l)
j=O
231
2- j + 1
(16.94)
Continued fractions
For an explanation of the notation, see (4.67) on page 65.
7r
111111111111
3+ - - 7 + 15 + 1 + 292 + 1 + 1 + 1 + 2 + 1 + 3 + 1 + 14 + ...
12
32
52
72
92
-=1+- 7r
2+2+2+2+2+ ...
(16.95)
(16.96)
Brouncker, 1658
4
7r
2 13 35 57
1+7+ 8 + 8 + 8 + ...
(16.97)
7r
2 13 35 57
'2=1+'3+4+ 4 + 4 + ...
(16.98)
4
12
22 32 42
-=1+7r
3+5+7+9+ ..
7r 2
1 1.1 1.2 2.2 2 .3 3 .3 3.4
-=1+- 6
1+ 1 + 1 + 1 + 1 + 1 + 1 + ...
12
14 24 34 54
- 2 = 1+- 7r
3 + 5 + 7 + 9 + ...
~ = 1-! 23
12 45
2
3- 1 - 3
1 - ...
(16.99)
(16.100)
(16.101)
(16.102)
Stern, 1833
12
32 52 72
7r=3+- 6+6+6+6+ ..
Lange, 1999 [80)
(16.103)
232
16.
7r
Formula Collection
Arctan relations
With the notation [xJ
arctan ~:
2:: = [lJ
(16.104)
i = 2[v'2J + [2v'2J
i = 2[3V3J + [4V3J
(16.105)
Wetherfield, 1996
(16.106)
~ = [2J + [3J
(16.107)
Euler, 1738
(16.108)
Strassnitzky, 1844
7r
-4 = 2[2J - [7J
(16.109)
Hermann, 1706
~=
2[3J
+ [7J
(16.110)
Hutton, 1776
(16.111)
Loney, 1893
(16.112)
Euler, 1764
~ = 4[5J - [239J
(16.113)
Machin, 1706
~ = 5[7J + 2[79/3J
(16.114)
(16.115)
St0rmer, 1896
(16.117)
(16.118)
(16.119)
22[28J
+ 2[443J -
5[1393J - 1O[11018J
(16.120)
Escott
(16.121)
16.
= 44[57] +
71'
Formula Collection
233
(16.122)
St0rmer, 1896
(16.123)
St0rmer, 1896
(16.124)
(16.125)
(16.126)
= 1074[4246] +
(16.127)
(16.128)
= 50539[51387] +
(16.129)
(16.130)
~=
[n2
n=l
Knopp
+ n + 1]
(16.133)
234
16.
Formula Collection
'If
00
~=
2: [F2n+1]
(16.134)
n=1
1, F2
1, Fi+2
Fi+l
+ Fi, i 2::
3\1'5 - 5 ~
2
- L.J Hn [(3Hn+2
'4'If =
3
/
+ F 2n+2)
2]
(16.135)
n=1
Arndt, [7], 1994
Miscellaneous formulae
'If
1-i
2iln -1-'
(16.136)
+t
[2(1/2)!]2
(1/2)!(-1/2)!(-1/2)
oo
where r(x) := fo e-
e-
dt for
= ((2)
(16.138)
where ((8)
'If
= lim
~~=1
';8
n--+oo
Fi+1
+ F;, i 2::
Matiyasevich [84]
'If
-11
22
7
x4(1 - X)4 dx
(16.140)
1 + x2
e+1=2+4~
1
~(2'1f'T')2+1
e-1
(16.141 )
i 6 = II
00
'If
k=O
2 (k_l)
(k+2)
27(k+~)(k+!)
0
0]
11
(16.142)
4= ~ (I!
177r
360
!)2 .
k- 2
+ 2 + ... + k
235
(16.143)
k=l
A u- Yeung, 1993, after http://www . nas. nasa .gov/Pubs!NASnelis/97!OS/math. html
37 6
22:S0 = (2 (3)
+L
(1
1)2
+ "2 + ... + k .
00
k-
(16.144)
"=1
Iterative algorithms
Algorithm (16.145) Archimedes, 250 Be, linear
(alg 16.145)
lni tialise:
ao := v'3
bo :=2
Iterate:
ale+1 := ale
bk+1 :=
+ ble
Jl
+a%+l
--+
6 2k+ 1/ 7r _
6.2"+1/ 7r +
--+
Then:
bk+l
62 k +1
<
<
ak+l
7r
6.2 k +1
Archimedes, c. 250
Be
(alg 16.146)
Initialise:
po :=.)2
qo := 1
Iterate:
PIe+1 := Pk+qk
2
qk+1 := VPk+ 1qle
Then:
_ 4_
qk+l
< 7r <
--+
1
--+
.1
7r
.1
_4_
Pk+l
Iterate:
:= (2ak)/(I- a%)
._ {I
b(x) .0
If x < 0
Else
Then:
.1
7r
,,",00
6k=0 27'+T
Plouffe from [36]
-
(alg 16.147)
236
16.
7r
Formula Collection
(alg 16.148)
Initialise:
ao := 1
bo := 1/V2
So := 0.5
Iterate:
ak+l
bk+1
C%+1
S"+1
+ bk)/2
v'akbk
:= (ak
:=
Sk - 2 k+ 1c%+1
(a n +bn )2
Then:
Pn
7r -
Pn
2s n
7r
7r2n+4e-7f2n+l
AGM2(1,1/V2)
(alg 16.149)
Initialise:
ao := 1
Ao := 1
Bo := 0.5
So := 0.5
Iterate:
+ Bk)/4
T := (Ak
bk
ak+!
Ak+l
Bk+l
Sk+1
Vlfk
:=
:=
:=
:=
:=
a%+l
An+Bn
(ak
+ b,,)/2
2(Ak+1 - T)
Sk + 2k+ 1(Bk+l - Ak+1)
Then:
pn
8n
7r
(alg 16.150)
Initialise:
ao := V2
bo := 0
Po := 2 + V2
Iterate:
ak+l := (y'ak + vh)/2
bk+! := (y'ak(l + bk/(ak + bk)
Pk+1 := (Pk bk+1(1+ak+1/(1+bk+1)
Then:
IPn -
7r1
<
_1_
102 n
J. and P. Borwein, 1984 [30, p. 360]
--t
7r
16.
7r
Formula Collection
237
(alg 16.151)
Initialise:
ao := 1/3
So
:=
(\1'3 -
1)/2
Iterate:
rk+1 := 3/(1 + 2(1 - SI)1/3)
Sk+1 := (rk+1 - 1)/2
ak+1 := r~+1 - 3k(r~+1 - 1)
1
71'
(alg 16.152)
4V2
V2 - 1
ao := 6 Yo :=
Iterate:
Yk+1 := 1- y~)-1/4 - 1)/1 - y~)-1!4 + 1) -4 0+
ak+1 := akl + Yk+1)2)2 - 2 2k +3Yk+1 1 + Yk+1)2 - Yk+1)
Then:
<
an -
7r-
::::
---+
1
71'
(alg 16.153)
:=
5(j5 - 2)
ao
:=
1/2
Iterate:
+ x/z + I?)
Sk+1 := (25)/(Sk(Z
where
x:=..... -1
Sk
r/
+7
5
+ J~yn2---4'-x03)
5k (8&2- 5 + J~Sk-("-S""'%----=2S-k-+""-;:5"))
y:= (x - I?
z :=
ak+1
(~
= s~ak
(Y
-
Then:
an -
< 16 5 n e-7I'5
238
16.
iT
Formula Collection
(alg 16.154)
Initialise:
Iterate:
ao
ro
:=
1/3
:=
So
:= (1 -
(v'3-1)/2
r8)1/3
:= 1 + 2rk
u := (9rk(1+rk+rml/3
v := t + tu + u 2
m := (27(1 + Sk + s~/v
2
ak+l
S1<+1
+ 3 2k - 1 (1 - m)
:= (1- rd)/((t + 2u)v)
:=
mak
rk+l := (1 -
sD
.!.
.".
17. Tables
17.1 Selected constants to 100 places (base 10)
~
1/~
6/~2
~2
~3
= 31.0062766802
~4
= 97.4090910340
~e
= 22.4591577183
e~
= 23.1406926327
e~/4
In~
log2~
log10~
26253741264 0768743.
9999999999 9925007259 7198185688 8793538563 3733699086
2707537410 3782106479 1011860731 2951181346 1860645041
240
17. Tables
1T
(base 10)
(0051)
(0101)
(0151)
(0201)
(0251)
(0301)
(0351)
(0401)
(0451)
(0501)
(0551)
(0601)
(0651)
(0701)
(0751)
(0801)
(0851)
(0901)
(0951)
(1001)
(1051)
(1101)
(1151)
(1201)
(1251)
(1301)
(1351)
(1401)
(1451)
(1501)
(1551)
(1601)
(1651)
(1701)
(1751)
(1801)
(1851)
(1901)
(1951)
(2001)
(2051)
(2101)
(2151)
(2201)
(2251)
(2301)
(2351)
(2401)
(2451)
5820974944
8214808651
4811174502
4428810975
4564856692
7245870066
7892590360
3305727036
0744623799
9833673362
6094370277
0005681271
1468440901
4201995611
5187072113
5024459455
7101000313
5982534904
1857780532
3809525720
0353018529
5574857242
8175463746
8583616035
9448255379
9331367702
2533824300
6782354781
5570674983
3211653449
6369807426
8164706001
1613611573
4547762416
5688767179
8279679766
7392984896
0674427862
4677646575
9465764078
2671947826
4962524517
5709858387
6868386894
8459872736
4390451244
4169486855
0168427394
6456596116
5923078164
3282306647
8410270193
6659334461
3460348610
0631558817
0113305305
5759591953
6274956735
4406566430
0539217176
4526356082
2249534301
2129021960
4999999837
3469083026
7838752886
2875546873
1712268066
1065485863
6899577362
4541506959
4939319255
6370766010
7747268471
8989152104
3558764024
6360093417
8505494588
8720275596
5425278625
6145249192
5255213347
8625189835
0494601653
8145410095
0841284886
2039194945
7396241389
9512694683
8482601476
4939965143
4105978859
2774155991
4469584865
1365497627
5848406353
5226746767
3548862305
0628620899
0938446095
8521105559
2847564823
4543266482
4881520920
4882046652
0921861173
1885752724
8602139494
2931767523
7785771342
4654958537
8640344181
2978049951
4252230825
5875332083
1159562863
1300192787
2788659361
2599413891
5082953311
0604009277
4710181942
0404753464
7521620569
7496473263
2164121992
5869269956
0236480665
5181841757
1732172147
5741849468
6948556209
4668049886
3883786360
2694560424
0471237137
0865832645
9835259570
9909026401
1429809190
5977297549
8559252459
3836736222
8079771569
4220722258
8895252138
7745649803
8628034825
5058223172
6446229489
3786783165
1339360726
9628292540
1384146951
8193261179
8912279381
6395224737
8467481846
7577896091
1050792279
5981362977
0597317328
3344685035
8142061717
8823537875
6611195909
5338182796
2497217752
6861727855
0167113900
9555961989
6208046684
6602405803
9141992726
4586315030
9092721079
4991198818
4672890977
7235014144
4385233239
9219222184
2723279178
9506800642
1965285022
8696095636
9958133904
9825822620
3639443745
6592509372
8930161753
5395943104
6260991246
1435997700
2848864815
5225499546
5593634568
3421170679
5359408128
5493038196
2712019091
0249141273
9171536436
9415116094
3105118548
8301194912
1907021798
7669405132
7363717872
6892589235
4771309960
1609631859
2619311881
7669147303
9375195778
2164201989
8230301952
8347913151
8890750983
9848824012
4676783744
2590694912
8150193511
0426992279
2861829745
7509302955
3479775356
7727938000
1973568548
0739414333
2725502542
6085784383
2512520511
2106611863
4371917287
7802759009
5224894077
5305068203
2169646151
9284681382
9972524680
0805124388
1296160894
8456028506
6672782398
1743241125
1507606947
2287489405
9009714909
2265880485
5428584447
2135969536
0374200731
8687519435
8191197939
9839101591
5679452080
6638937787
0306803844
6660021324
1005508106
4011097120
2305587631
7321579198
7229109816
5725121083
6711136990
3515565088
8932261854
6549859461
2332609729
5836041428
1809377344
4492932151
2131449576
2807318915
6655730925
4769312570
3348850346
8455296541
7002378776
1127000407
6343285878
2021149557
0990796547
2996148903
9389713111
0480109412
8530614228
7716692547
9769265672
8888007869
6171196377
4252308177
6222247715
7805419341
9451096596
6010150330
6759852613
7564014270
9526586782
2314429524
0578539062
0643021845
9520614196
9561814675
9514655022
0830390697
7734549202
3408819071
6587969981
6280439039
7635942187
4148488291
9091528017
5791513698
8658516398
4909989859
8963213293
6371802709
9712084433
1388303203
4030707469
6084244485
8572624334
4411010446
4711055785
5863566201
1136576867
2665408530
5913440171
8547332699
5698305235
6158140025
3761255176
0463994713
7904297828
1472213179
8137585043
4873898665
1463853067
2560290228
9213375751
0367515906
8915049530
4473774418
7r
(base 10)
0940252288
8617928680
6554978189
4775551323
1051141354
8493718711
1983874478
3191048481
6342875444
1426912397
5231603881
9207734672
6054146659
0486331734
6357473638
7595156771
3125147120
6447060957
3506712748
8209144421
3150197016
9823873455
3089857064
8199430992
5732654893
8249037589
2112019130
9637669838
4189303968
8232527162
3763466820
8558100729
5324944166
6143444318
2749470420
3908145466
8089330657
0126228594
5675135751
2962107340
5647503203
4764777262
0633217518
4949450114
3609657120
4721040317
1495950156
7350235072
9844489333
4263129860
7971089314
9208747609
3129784821
7964145152
7357395231
0145765403
0847848968
0053706146
0643745123
4894090718
9301420937
2182562599
2520149744
6496514539
4052571459
5770042033
5329281918
5270695722
5832228718
0067510334
5151168517
2833163550
2046752590
4488957571
8239119325
8524374417
2033038019
9522868478
6426243410
0105265227
6531098965
3606598764
8039626579
5867697514
5622305389
4645880797
5740679545
1302164715
7829666454
4375189573
1986915140
2414254854
2979866223
6540628433
9180763832
2118608204
6049631862
8354056704
0963408780
8099888687
5669136867
1782493858
6829989487
3746234364
1342716610
5902799344
3321445713
8067491927
7181921799
6494231961
6213785595
6615014215
2850732518
0579626856
1028970641
7869936007
2618612586
0917567116
3520935396
6711031412
1437657618
7647918535
7091548141
2828905923
9746366730
0291327656
7621101100
3123552658
7732269780
2111660396
2691862056
8611791045
7877185560
5661406800
9456131407
2708266830
7163775254
5097925923
7791745011
5961458901
2870808599
5403321571
7172159160
6639379003
7166416274
1900042296
9472654736
0386743513
7693259939
4132604721
241
242
17. Tables
(0051)
(0101)
(0151)
(0201)
(0251)
(0301)
(0351)
(0401)
(0451)
(0501)
(0551)
(0601)
(0651)
(0701)
(0751)
(0801)
(0851)
(0901)
(0951)
(1001)
(1051)
(1101)
(1151)
(1201)
(1251)
(1301)
(1351)
(1401)
(1451)
(1501)
(1551)
(1601)
(1651)
(1701)
(1751)
(1801)
(1851)
(1901)
(1951)
(2001)
(2051)
(2101)
(2151)
(2201)
(2251)
(2301)
(2351)
(2401)
(2451)
3.243F6A8885
2EFA98EC4E
29B7C97C50
A698DFB5AC
F12C7F9924
574E69A458
4AEE7B54A4
FOCA417918
D71577C1BD
48986263E8
86AF7C72E9
169B87931E
6B4BB9AFC4
EC8032EF84
ACC50F6D6F
5E21C66842
960FA728AB
F1651D39AF
A5C33B8B5E
62363F7706
49F1C09B07
794C3B976C
246368FB6F
2CCC814544
COCBA85745
Al00C6402C
16DFFD616B
483EOODF82
287EFFC3AC
FOllA010FA
4565D28E49
E8EF20CADA
EAAD8E716B
F6E2FBF212
F191B3A8Cl
OFB56F74E8
D2ADA8D916
B5FA86C754
7E4900250E
lE5563911D
8326037662
5100529A53
6FB5571BE9
2EC5855664
B5B32944DB
EDB266ECAA
4C29A05913
D6A1D29C07
6382E9C602
7F358452AO
A308D31319
6C89452821
DD3F84D5B5
2FFD72DBDO
A19947B391
FEA3F4933D
lDC25A59B5
B8DB38EF8E
314B2778AF
144055CA39
93B3EE1411
AFD6BA336C
BFE81B6628
5D5DE98575
F383F44239
F6E96C9A67
5133A36EEF
017666CA59
BEE06F75D8
lB.FEDF7242
5372C98099
EOBD04C006
AF3E6C53B5
AF5EBD09BE
C8740FD20B
7279679F25
152F501EC8
9E5C57BBCA
6732C68C4F
3D98FD2183
BC4BFB9790
36774C01DO
93D5AOD08E
2B648888B8
AD2F2F2218
18ACF3D6CE
5FA2668095
42F5FB9D35
2D2071B35E
59DFA6AA78
95CFA911C8
2915D60F57
lFF296EC6B
53B02D5DA9
75092EC419
8C71699A17
40E4183A3E
EFE830F54D
lECC5E0968
E286B79C53
8A2E037073
E638D01377
B547091792
lADFB7B8El
6CF70801F2
7EOD95748F
9C30D5392A
79DCB0603A
2FDA55605C
6A2AAB10B6
636FBC2A2B
24CF5C7A32
219361D809
B1DC262302
2EOB4482A4
OC9C61ABD3
OB6C137A3B
3E82430E88
85C1207340
9B023D37DO
lB7B25D479
BAC1A94FB6
1339B2EB3B
E3D004DE33
5F39B9D3FB
FEFB1FA3CC
AD0552AB32
6F8CA01A87
5573695B27
B84AFCB56C
E1DDF2DAA4
7E9EFE2BFl
D1DOAFC725
12900DF01C
BEOE1777EA
89E299B4A8
770593CC73
CFEBCDAFOC
226800BB57
C14389D95A
19684E734A
3FBC9BC6E4
2AODD915B6
9F8FA108BA
2623AD6EA6
FF5664526C
3F54989A5B
2D38E6F025
6B3F3EBAEF
05AA500737
44A4093822
BE5466CF34
16D5D98979
AFED6A267E
E2858EFC16
728EB65871
F26013C5D1
180E6C9EOE
60E65525F3
B4CC5C3411
A9C55D7418
5381289586
CCFB21A991
EB651B8823
84200469C8
88F06A51AO
E4BA3BF050
8CEE861945
lA449F56Cl
D724DOOA12
D8F6E8DEF7
409F60C45E
52EC6F6DFC
4AFD660F28
DB5579COBD
8EA5E9F8DB
3DB5FAFD23
562EDF1769
BOBBCA58C8
2DD1D35B9A
CB7E3362FB
lFB495DBDA
E08E3C5B2F
4FAD5EA068
752DFE8B02
4FEOFD13EO
14211A1477
7B3E89AOD6
B8EOAF2464
537F207D5B
41B3472DCA
2B60A47681
636521E7B9
47996E8507
B049A7DF7D
C2B19EEl19
429D656B8F
5DC14CDD20
C93C971814
3E07841C7F
299F31D008
E90C6CCOAC
FB1BD1310B
96BA7C9045
636920D871
8BCD588215
B023286085
8BB01E8A3E
AA55AB9457
41E8CEA154
31F6CE5C3E
773B8F4898
487CAC605D
893E81D396
F04A9E1F9B
D2D8542F68
7EFB2A98Al
6F9FB47D84
6AA64ED3AA
48DBOFEAD3
E3FE501AB6
5C9EC2196A
511F9B3095
07192E4BB3
lA60320AD6
3222F83C75
876053317B
DBD542A8F6
E1FFA35DB8
53E479B6F8
1341CEE4C6
4DAE909198
8E7594B78F
8FC31CD1CF
lFA1E5AOCC
B77CC43B81
E6AD206577
411BD3AE1E
369BF009B9
A202E5B9C5
7B14A94A1B
E6740008BA
F9B6FF3405
6A4B7A70E9
9CEE60B88F
3602A57509
E4D699F73F
868470EB26
6B6A70A168
DEAE5C8E7D
44EC5716F2
lA3CB574B2
22F547013A
D0030EECC8
B3314E548B
795679B072
5512721F2E
9F9ABCE94B
18473215D9
02133AE4DD
D7A3C76B3C
153C6E86E3
06FA2965DC
6AC6150EBA
1939260F19
BC4595A67B
218568AB98
2829076170
AA0363CFB5
622CA79CAB
BB5040685A
9995F7997E
OE358829C7
83C3FF1AC2
F2EF34C6FF
14203E13EO
EF6ABBB565
816250CF62
749247848A
0058428D2A
D65FECF16C
07808419F8
ABFC800BCA
D3105588CD
F16DFF2015
8140F7F64C
0068D40824
4614214F74
BFBC09EC03
2547E6ABCA
1462D74869
067AF4D6B6
D9F385B9EE
E397B23A6E
B397454056
4B55A867BC
5EF47E1C90
Cl1548E4C6
79A45D886E
34602A9C60
B8B03ADA37
25837A58DC
E5E58137C2
C73EA4751E
384F6DB908
BCAF89AFDE
6B7124501A
7D8CEC7AEC
08DD433B37
71DFF89El0
11183B5924
4570EAE96F
B999E71DOF
94E2EA78A5
C279605223
C883B17F37
02EECEA50F
ECDD477561
735C904C70
5CABB2F384
323C2AB4B3
623D7DA8F8
E61FD696DE
4696CDB30A
EAFE28ED61
45EEE2B6A3
4F3B1D41CD
A1F25B8D26
OB5692B285
OC55F5EA1D
223BDB7CDE
509EE8EFD8
DC9E447A2E
675FDA79E3
3E21E78FBO
261C946929
713320F46A
BF8B88404D
BD97857FAC
OA9A285078
00680ECOA4
AACE1E7CD3
39D7AB3B12
FA74DD5B43
ACBA489527
Al159A58CC
29317CFDF8
6D2248C113
17325F51EB
DFF8E8A31F
F0500CODFO
0921BDD191
DADCC8B576
41E238CD99
6F420D03F6
9A771FD993
DDE69F84CD
3ADB851DFA
24C2BA1612
314E5581AC
A509F28FE6
B1860E5EOA
803E89D652
FC3C531EOA
A708F71312
Dl018CFF28
DB2F953B2A
9F151013CC
A239D59E9E
6E648B1EAF
319EE9D5CO
37889A97E3
DFA17858BA
EB532E3054
EE7C3C735D
AAABEADB6C
2105D81E79
46FC8883AO
095BBFOOAD
ADF43E233F
3759CBEE74
5561D99735
C3453484FD
674340C5C4
3D4AE6E39F
34411520F7
43B7D4B750
95FC1D96B5
6DD031CB85
25530429F4
27A18DEE4F
375FECCE78
4E8B1DC9FA
326841E7F7
55533A3A20
A9296399El
E80204272F
3FC70F86DC
D59BCOD1F2
636C1BOE12
lC1F040200
13F97CA92F
349AF3DDA7
3BEAOE2F32
OA04BF2CB8
0810B38BAE
877A584718
63094366C4
A14D432A65
77D65Fll19
ED97F1FBFA
5A3E2AB377
66C8252E4C
2DF4F2F74E
B6EBADFE6E
C332DDEFBE
EF7DAD5B6E
A830EB61BD
OBCBAADE14
19BDFOCAAO
21B8F79B54
2D7711ED93
9957F584A5
8FD948E46D
4A14D9E864
4F15FACB4F
9E86854DC7
C1C7B6A37F
19489D1462
70613372FO
604085F2A7
A969A7AAC5
D567050E1E
3465713E38
2BDB83ADF7
7602D4F7BC
0061AF1E39
91AF70F4DD
0496EB27B3
OA2C86DAE9
3FFEA2E887
A399406B2A
F74B6D1856
CA7820FBFB
838D87FE6B
DB33A62A4A
7080BB155C
07F9C9EE41
BCC18F4111
B4C202E132
B3FFAEOCF5
F694324773
A94461460F
80BBAl183E
129024977C
12DCCF3F2E
7408DA17BC
64C3D2EF1C
C451509400
9B043556Fl
9EBABF2C1E
lFE71C4E3D
C9789Cl0B3
A7361D2B3D
EAC31F66E3
6C5AA56558
2F841521B6
960334FE1E
EECC86BC60
2369B9655A
OB19875FAO
5F16681281
lB2272639B
BC312858EB
B7E342105D
DOC742F442
E44B476A3D
1524C369CB
B17423820E
928D937E41
CE77326EA6
OC06C25A04
9EC9DB73DB
D83D28F89E
E93D5A6894
F46B2ED4A2
F62E972445
D366A02F45
55FD3941DA
B66DFB68DC
AD8CB58CEO
4220FE9E35
26A36631EA
OAF54ED8FE
A9B7D09695
563F3125F9
05282CE395
041FOF4047
3564257B78
9EAF664FDl
243
244
17. Tables
7r
292
1 1
1 15 3
1 7 1
2
1 6
2 2 1
2 2 8
1 1 7
3 7 30
1 2 1
4
1 1
15
1 3
5
1 3
1 1 2
1 4 1
1 4 5
5 4 1
4
3 1
5 2 1
2
1 2
3
1 1
1 1 3
4 15 1
94 55 1
50
2 16
2 28 1
1 19 2
2
1 1
1 3 2
2 1 2
3 2 1
131
23
1 18
1
29
4
4
7 17
3 5
1 1
1 6
16 125 1
1
6
4
2
47
4
20
2
1
3
1
2
2
1 1
1 3
2 4
2 2
1 3
2 1
1 1
2 7
1 2
13 1
2 3
1 1
4 1
1 5
2 4
1 1
4 1
1 5
7 1
13 7
2 1
1 1
2 1
436 8
1 1
4 1
1 1
1 2
24 1
4 44
1 2
5 1
1 13
7 1
1 1
2 2
1 2
1 1
12 10
2 10
1 1
3 1
130
1 1
4 1
5 10
2 2
1 3
13 12
2 12
1
61
159
1 8
6 1
2 1
3 2
4 4
2 1
1 4
2 3
1
4
7
5
2
2
9
1
12
3
16
9
3
1
1
1
3
1 14 2 1 1
2
6 6 99 1 2
1
2 1 1 12 1
2
2 3 1 2 4
24
1 2 1 3 1
2
26 1 4 1 1
7
2 3 1 57 1
3
3 3 1 2 8
1
1 3 3 28 1
2
1 6 1 4 1
1
2 1 21 2 1
1
1 1 1 1 5
1
1 1 3 1 1
7
1 1 2 1 11
4
3 1 2 3 1
2
2 1 1 1 1
2 5
4 6 9 1 5
6 1
1 1 4 3 2
2 2
7 1 15 1 4
1 1
1 1 1 9 1
2 4
10 5 12 3 3
1 4 20776 1 1 1 1
1 1
3 1 1 32 5
2 1
4 6 3 1 3
1 5
43 1 4 3 5
72 3
1 2 3 7 11
1 33
7 19 1 19 3
2 4
1 1 1 4 2
2 1
7 2 27 1 1
1 1
15 1 36 4 2
7 1
2 1 111
3 1
6 6 13 8 6
1 2
5 5 1 1 2
141 1
2 7 7 2 2
1 12
4 18 10 2 8
11 2
4 2 1 1 3
2 1
19 1 4 1 1
4 14
1 1341 1 4
2 1
4 1 14 1 2
425
427 2 7 1
1 3
1 6 1 133
2 12
1 12 1 2 5
1 9
14 1 1 3 2
376 2
107 1 10 3 2
6 1
111 2 8
1 1
516 1 2
2 5
4 7 1 4 2
2 2
512 1 1
3 1
1 5 1 1 1
1 2
1 2 4 2 1
2 2 2
2 6 3
1 1 3
4 16 1
2 1 1
8 2 42
18 1 9
1 1 2
10 3 2
120 2 1
1 2 9
4 1 1
10 3 1
3 1 7
2 2 1
1 5 1
1 5 15
2 1 1
8 1 1
4 3 15
21 1 2
1 1 1
1 14 1
3 1 2
3 1 4
1 2 1
1 4 1
3 1 1
6 2 1
2 1 22
824
2
2
5
1
161
10
2
19
1
20
1
1
3
3
1
2
2
1
2
4
1
1
23
1
2
1
1
1
1
9
2
1
1
1
45
2
1
1
15
1
3
6
1
1
4
5
1
11
1
2
2
34
1
1
2
1
2
1
1
6
1
5
2
3
1
6
1
4
11 1 6
1
711
7
122 2
3 12 1
1 39
214
1 10
181
1
2
818 3
3
126 1
1
1 5 3
1
5
3 1 1
1
1
1 9 3 22 13
231 1 2 10
273 3
5 42
6 1 1
1
1
261
1
2
10 1 6
1 129
112 2
1
227 6
2
1
1
8
2
1
1
2
1
2
6
4
3
1
1
4
1
2
3
1
1
1
9
8
3
12
4
2
4
4
1
11
1
1
1
1
1
1
1
1
2
2
3
2
3
1
3
1
60
7
1
4
(1201) 15 8
(1221) 156 88
(1241)
2 11
(1261)
1 1
(1281)
3 1
(1301) 11 3
(1321)
3 2
(1341)
5 1
(1361)
9 2
(1381)
1 1
8
1
1
1
7
1
2
2
1
2
2
1
5
4
13
7
41
2
5
1
3
2
1
3
1
5
2
1
1 34
13
1
7
1
9
1
2
18
5
1
35 2 1
8 1
3 6 3
1 3
15 2 1
1 2
1 1 13
1 3
4 1 1
4 3
1 1 2 114 12
3 72 2
1 1
3 1 2
1 5
7 1 8
1 1
10 2 1
1 13
3
3
1
1
1
1
1
1
4
5
5 1
1 4
63 37
12 1
2 2
2 1
2 1
4 3
93 1
6 1
(1401) 26 1
1 4 12 1 3 2 1
(1421) 20 1 17 1
6 16 3 3 2
(1441)
2 1
2 1 45 3 1 1 3
(1461)
8 2 47 2
3 1 1 1 15
(1481)
2 1 161 1 26 2 1 2 1
(1501)
5 16
3 1
1 1 1 1 5
(1521)
9 5
2 3
2 5 7 1 32
(1541)
9 1
7 1 102 53 1 1 1
(1561)
4 1
1 3
2 3 1 1 2
(1581)
1 1
1 22
1 2 3 1 3
(1601)
(1621)
(1641)
(1661)
(1681)
(1701)
(1721)
(1741)
(1761)
(1781)
3
1
1
4
1
4
1
1
1
5
1 63 1
3
1 1
3
1 39
7
1 17
2
2 2
1
1 2
1
1 25
1
1 1
1
1 1
2
1 1
1
1
1
1
12
2
1
1
4
1
1
1
12
14
1
1
5
1
1
1
2
2
12
2
7
14
4
1
1
2
1
9
86
1
1
5
1
1
2
1
1 1
1 1
4 1
4 1
1 39
4 1
1 50
1 1
5 4
1 1
6
1
1
1
1
2
14
1
4
3
5 1 2
2 2 18
1 2 1
9 1 8
1 1 1
1 2 1
13 1 5
3 4 2
3 1 1
26 2 24
1
7
1
2
5
2
1
4
1
4
1
1
4
1
2
3
1
1
1
7
9
2
5
1
1
2
1
2
1
15
10 123 3
4
2 1
1
1 2
10
1 1
2
1 3
1
1 1
1 58 7
1
1 2
2 73 1
1 16 28
1
2
2
1
3
1
1
5
1
17
1
1
1
1
1
1
3
21
1
1
1
2
3
1
44
1
94
1
2
67
1
1
1
2
14 18
1
1
2 10
2
5
2
4
1 10
9
2
5
7
8
8
9
3
1
8
3
41
1
1
1
12
3
1
14
3
4
1
2
23
3
1
2
1
1
2
5
5
1
3
3
53
2
10
2
1
1
1
1
3
1
1
2
1
1
2
1
4
1
1
(1801)
1 4
1 5
1 1 8
(1821)
2 1
3 1 11 2 10
(1841)
3 4
1 18
3 9 7
(1861)
4 1 54 2 196 10 3
(1881)
1 3
6 3 16 1 31
(1901)
3 1
2 1
1 1 4
(1921) 16 4
1 2
4 1 4
(1941)
1 30
1 1
3 2 2
(1961)
3 6
1 1
2 4 4
(1981)
1 6
6 2
1 1 10
1
1
5
1
1
1
1
1
24
6
1
4
1
32
5
13
1
1
1
4
5
1
2
40
1
88
2
10
1
1
2 10 1
2 3 1
1 7 1
55 1 5
442 4
1 1 1
4 1 1
1 7 1
1 1 1
3 9 1
1
1
23
1
1
14
9
6
3
2
7i"
6 6
1 1
2 1
7 1
1 4
1 2
1 1
2 6
1 1
2 3
4 59 4
3
2 1
4
2 18
5
1 1
5
2 1
3
1 3
2
1 1
1 148 1
3
1 1
2
5 5
9 3
2 41
1 16
15 1
1 51
4
9
3 1
1 3
5
1
2 1
4 2
4 14
2 2
1 18 528 12
63 1 97 1
4
4
4 1
7 1
3 12
15 2
8 2
2
3
6 1
1 14
1 80
2 2
4 3
1
1
25
2
1
1
3
34
1
1
1
7
2
18
2
1
6
1
17
4
1
2
3 56
13
1
2
2
2
9
1
1
1 19
1
1
6
2
1
1
1
1
245
2
5
2
1
4
10
1
1
11
1
2
2
3
12
1
5
3
2
1
1
10
5
6
2
1
1
1
1
3
2
2
3
43
4
1
13
4
3
1
1
1
4
1 155
6 23
1
6
1 11
2
5
1
1
7
2
1
1
2
1
1
1
4
2
3
1
2
8
3
57
2
1
6
3
2 217
3
3
10
1
3 27
2
1
1 35
1
1
16
1
3 1
4 31
2 1
2 2
1 3
1 1
3 1
1 2
1 2
1 1
1
6
1
1
3
3
1
1
2
5
The following is (almost) the documentation that comes with the hfloat
package1 .
248
249
>
250
251
= N (R -
1)2
This is N times the product of two 'nines' (R - 1), which can appear
in the middle term of the convolution. Cm needs
log2(N (R - 1)2) = 10g2 N
5
6
+ 2 log2(R -
1)
252
+ 2 log2 (R -
1)
+S
[og2(R)
253
254
255
- - - end of legal stuff - - Please be nice and give me credits if you use hfloat for anything interesting/noticable/scientific. I am interested in hearing about your
project.
If you use hfloat for scientific purposes then cite it in your publications as you would cite an ordinary publication.
Please check for newer versions before passing hfloat on. I tend to
upload new versions even for small changes.
If you notice errors in the code or the documentation please take the
time and drop me an email.
I
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
j
Bibliography
1. Victor Adamchik, Stan Wagon, A Simple Formula for 'IT, American Mathematical Monthly, Vol 104 (1997) 852-855, also in [20, pp. 557-559J.
(Cited on p. 126)
2. Victor Adamchik, Stan Wagon, Pi: A 2000- Year Search Changes Direction,
Education and Research, Vol 5 (1996), No.1, 11-19,
online at http;llmembers. wri. comlvictor/articles/pi .html
(Cited on p. 19, 126, 227)
3. Association pour Ie Developpement de la Culture Scientifique (ADCS), 61 rue
Saint-Fuscien, 8000 Amiens France, Le nombre 'IT, Sonderheft zur Zeitschrift
Le PETIT ARCHIMEDE.
4. Timm Ahrendt, Schnelle Berechnung der komplexen Quadratwurzel auf hohe
Genauigkeit, Logos Verlag, Berlin, 1996.
Online at http://web.informatik.uni-bonn.de/II/staff/ahrendt/
AHRENDTliteratur.html
(Cited on p. 148)
5. Gert Almquist, Many Correct Digits of 'IT, Revisited, American Mathematical
Monthly, Vol. 104 (1997), No.4, 351-353.
(Cited on p. 157)
6. Archimedes, Measurement of a Circle, in The Works of Archimedes, Ed. by
T.L. Heath, Cambridge University Press, 1897, also in [20, pp. 7-14J.
(Cited on p. 171)
7. Jorg Arndt, Remarks on arithmetical algorithms and the compuation of 'IT,
Online at http://www . j j j . del j oerg. html.
(Cited on p. 75, 110, 233, 234)
8. Nigel Backhouse, Pancake functions and approximations to 'IT. The Mathematical Gazette, Vol. 79 (1995), 371-374.
(Cited on p. 234)
9. David H. Bailey, The Computaion of 'IT to 29,360,999 Decimal Digits Using
Borweins' Quarlically Convergent Algorithm, Mathematics of Computation,
Vol. 50, No. 181 (Jan. 1988), 283-296, also in [20, pp. 562-575J.
(Cited on p. 202)
10. David Bailey, Peter Borwein and Simon Plouffe, On The Rapid
Online
at
Computation of Various Polylogarithmic Constants,
http://www . cecm. sfu. carpborwein, also in [20, pp. 663-676J.
(Cited on p. 118, 123)
11. David H. Bailey, Jonathan M. Borwein and Peter B. Borwein, Ramanujan,
Modular Equations, and Approximations to Pi or How to compute One Billion
Digits oj Pi, American Mathematical Monthly, Vol. 96 (1989), 201-219, also
in [20, pp. 623-641J.
(Cited on p. 6, 105)
258
Bibliography
Bibliography
259
260
Bibliography
44. James W. Cooley, Peter A.W. Lewis and Peter D. Welch, Historical Notes on
the Fast Fourier Transform, Proceedings of the IEEE, VoL 55 (October 1967),
No. 10, 1675-1677.
(Cited on p. 199)
45. David A. Cox, The arithmetic-geometric mean of Gauss, L'Enseignment
MatMmatique, t. 30 (1984), 275-330, also in [20, pp. 481-536].
(Cited on p. 95, 96, 97, 98)
46. David A. Cox, Gauss and the Arithmetic-Geometric Mean, Notices of the
American Mathematical Society 32 (1985), 147-151.
(Cited on p. 95)
47. Richard E. Crandall, Projects in Scientific Computation, Springer-Verlag,
New York, Inc., 1994.
(Cited on p. 230)
48. Jean-Paul Delahaye, Pi - die Story, Birkhiiuser-Verlag, Basel, 1999. Franzosische Originalausgabe: Le fascinant nombre 7r, Pour La Science, 1997.
(Cited on p. 50)
49. Drinfel'd, Quadratur des Kreises und Transzendenz von 7r, VEB Deutscher
Verlag der Wissenschaften, Berlin, 1980.
(Cited on p. 197)
50. Underwood Dudley, Mathematical Cranks, The Mathematical Association of
America, 1992.
(Cited on p. 8)
51. Heinz-Dieter Ebbinghaus, Reinhold Remmert, et aL, Numbers, SpringerVerlag, New York, 1990.
(Cited on p. 56, 168, 170, 176, 213)
52. LeQnhard Euler, Introduction to Analysis of the Infinite, Translation of: Introductio in analysin infinitorum, Book I, Translated by John D. Blanton,
Springer-Verlag, New York, 1988, Chapter 10 also in [20, pp. 112-128].
(Cited on p. 65, 166, 194)
53. Leonhard Euler, Einleitung in die AnalysiS des Unendlichen, Erster TeiL Ins
Deutsche iibertragen von H. Maser, Berlin. Verlag von Julius Springer. 1885.
(Cited on p. 166, 194)
54. Martin Gardner, Some comments by Dr. Matrix on symmetrics and reversals,
Scientific American, January 1965, 110-116.
(Cited on p. 24)
55. Carl Friedrich GauB, Mathematisches Tagebuch, 1796-1814, Reihe Ostwalds
Klassiker der exakten Wissenschaften, Akademische Verlagsgesellschaft Geest
& Portig K.-G., Leipzig 1985. Also in [56, X, pp. 483-574].
(Cited on p. 98)
56. Carl Friedrich GauB, Werke, Gottingen, 1866-1933.
(Cited on p. 73, 88, 95, 99, 232)
57. C.F. GauB, Nachlass zur Theorie des Arithmetisch-Geometrischen Mittels und
der Modulfunktion, herausgegeben von Harald Geppert, Reihe Ostwald's Klassiker der exakten Wissenschaften, Nr. 225, Akademische Verlagsgesellschaft,
Leipzig, 1927.
(Cited on p. 95)
58. Roland Girgensohn, personal E-Mail, 1997.
(Cited on p. 119)
59. Franz Gnadinger,
Primary Hill And Rising Sun, Online at
http://www.access.ch/circle/.
(Cited on p. 210)
Bibliography
261
60. Wei Gong-yi, Yang Zi-qiang, Sun Jia-chang, Li Lia-kai, The Computation of
7T to 10,000,000 Decimal Digits J. Num. Method & Compo Appl., 17:1(1996),
78-81.
(Cited on p. 158)
61. GroB, Zagier, On singular moduli, J. Reine Angew. Math., 355(1985), 191220.
(Cited on p. 27)
62. Bruno Haible und Thomas Papanikolaou, Fast multipliprecision evaluation
of series of rational numbers, Online at
http://www.informatik.th-darmstadt.de/TI/Veroeffentlichung/TR/
Welcome. html.
(Cited on p. 215, 217)
63. Godfrey H. Hardy, Ramanujan, Twelve Lectures on Subjects Suggested by his
Life and Work, Chelsea Publishing Company, New York, 1940.
(Cited on p. 106, 108, 109)
64. Sir Thomas Heath, A History of Greek Mathematics, Volume II From
Aristarchus To Diophantus, Dover Publications, 1981, first published 1921.
(Cited on p. 173, 174)
65. M. Heidemann, D. Johnson, C. Burrus, Gauss and the history of the Fast
Fourier transformation, IEEE ASSP Magazine 1, 1984, 14-21.
(Cited on p. 137, 199)
66. Joseph E. Hofmann, Geschichte der Mathematik, Sammlung Goschen Band
226 (Erster Teil) , Band 875 (Zweiter Teil) , Band 882 (Dritter Teil), Walter
de Gruyter & Co, Berlin 1953.
67. Dirk Huylebrouck, The 7T-Room in Paris, The Mathematical Intelligencer,
Vol. 18, No.2, 1996, 51-53.
(Cited on p. 50)
68. William Jones, Synopsis Palmariorum Mathesos, London, 1706, In extracts
in [20, pp. 108-109].
69. A.P. Juschkewitsch, Geschichte der Mathematik im Mittelalter, Teubner Verlag, 1964.
(Cited on p. 182)
70. Sven Kabus, Untersuchung verschiedener 7T-Algorithmen am PC, (PC investigation of various 7T algorithms), entry in the Jugend forscht (Youth researches)
competition, 1998, Junge wissenschaft (Friedrich-Verlag), 58 (1999),34-42.
(Cited on p. 63)
71. Robert Kanigel, The Man Who Know Infinity, Macmillan Publishing Company, 1991.
(Cited on p. 105)
72. Victor J. Katz, A History of Mathematics, HarperCollins College Publishers,
1993.
(Cited on p. 167, 168, 179)
73. Theo Kempermann, Zahlentheoretische Kostproben. Verlag Harri Deutsch,
Thun, Frankfurt am Main, 1995.
(Cited on p. 14, 158, 234)
74. Alexander Khintchine, Continued Fractions, Nordhoff, Groningen 1963
[Moskow 1935].
(Cited on p. 68)
75. Louis V. King, On the Direct Numerical Calculation of Elliptic Functions and
Integrals, Cambridge University Press, Cambridge, 1924.
(Cited on p. 57)
262
Bibliography
76. Konrad Knopp, Infinite sequences and series Dover Publications, New York,
1956
(Cited on p. 71, 78)
77. Donald E. Knuth, The Art of Computer Programming, Volume 2 Seminumerical Algorithms, Third Edition, 1998, 4th Printing August 1999.
(Cited on p. 28, 102, 120, 121, 132, 135, 180, 182)
78. Lam Lay-Yang and Ang Tian-Se, Circle Measurement in Acient China, Historia Mathematica, Vol. 13 (1986), 325~340, also in [20, pp. 20~44].
(Cited on p. 176)
79. Johann Heinrich Lambert, Memoire sur quelques proprietes remarquables
des quantites transcendantes circulaires et logarithmiques, Memoires de
l'Academemie de sciences de Berlin, [17] (1761), 1768, 265~322, also in [20,
pp. 129~140].
(Cited on p. 192)
80. L.J. Lange An elegant new continued fraction for n, American Mathematical
Monthly, Vol 106 (May 1999) 456~458.
(Cited on p. 33, 231)
81. Nick Lord, Recent calculations of n: the Gauss-Salamin algorithm, The Mathematical Gazette, Vol. 76 (1992), 231~242.
(Cited on p. 100)
82. Philipp Maennchen, GaufJ als Zahlenrechner, in [56, X.2,1-73].
(Cited on p. 57)
83. Eli Maar, e: the story of a number, Princeton University Press, 1994.
(Cited on p. 96)
84. Yuri V. Matiyasevich, Richard K. Guy, A New Formula for n, American
Mathematical Monthly, Vol. 93, (October 1986), 631~635.
(Cited on p. 234)
85. Niels Nielsen, Die Gammafunktion, Chelsea Publishing Company, Bronx, New
York, 1965 (first published 1906).
(Cited on p. 229)
86. Ivan Niven, Irrational Numbers, John Wiley and Sons, 1956.
(Cited on p. 22)
87. C.D. Olds, Continued Fractions, Mathematical Association Of America, 1963.
(Cited on p. 65)
88. Thomas J. Osler, The Union of Vieta's and Wallis's Products for Pi, American Mathematical Monthly, Vol. 106, (October 1999), 774~776.
89. S. Parameswaran, Whish's showroom revisited. The Mathematical Gazette,
76(1992), 28~36.
(Cited on p. 186, 223, 224)
90. Oskar Perron, Die Lehre von den Kettenbruchen, Band I und II, B.G. Teubner
Verlagsgesellschaft, Stuttgart, 3. Auflage, 1957.
(Cited on p. 65, 67)
91. G.M. Phillips, Archimedes and the numerical analyst, American Mathematical
Monthly, Vol. 88(1981), 165~169, also in [20, pp. 15~19].
92. Richard Preston, The Mountains of pi, The New Yorker, Mar. 2, 1992, 36~67.
(Cited on p. 2, 10, 34, 201)
93. Martin R. Powell, Significant insignificant digits, The Mathematical Gazette,
66(1982), 220~221.
(Cited on p. 156)
94. Stanley Rabinowitz, Abstract 863-11-482: A Spigot Algorithm for Pi, Abstracts Amer. Math. Society, 12(1991), 30.
(Cited on p. 37)
Bibliography
263
95. Stanley Rabinowitz and Stanley Wagon, A Spigot Algorithm for the Digits of
Pi, American Mathematical Monthly, Vol. 103 (March 1995), 195-203.
(Cited on p. 37, 77, 82)
96. Srinivasa Ramanujan, Modular equations and approximations to 71",
Quart. J. Math. 45 (1914) 350-372, also in [20, pp. 241-257].
(Cited on p. 27, 57, 58, 103, 105, 226)
97. Srinivasa Ramanujan, Squaring the Circle, J. Indian Math. Soc. 5(1913), 132,
also in [20, p. 240].
(Cited on p. 58)
98. Ranjan Roy, The Discovery of the Series Formula for 71" by Leibnitz, Gregory and Nilakantha, Mathematics Magazine 63 (1990), 291-306, also in [20,
pp.92-107].
(Cited on p. 186, 230)
99. Hansklaus RummIer, Squaring the Circle with Holes, American Mathematical
Monthly, Vol. 100 (November 1993), 858-860.
(Cited on p. 162)
100. Eugene Salamin, Computation of 71" Using Arithmetic-Geometric Mean, Mathematics of Computation, Vol. 30, No. 135, July 1976, 565-570, also in [20,
pp. 418-423].
(Cited on p. 87, 102, 231)
101. Eugene Salamin, E-Mail to Jorg Arndt, 1997.
(Cited on p. 102)
102. Norbert Schappacher, Edmund Landau's Goitingen: Prom the Life and Death
of a Great Mathematical Center, The Mathematical Intelligencer, Vol. 13,
No.4, 12-18.
103. L. Schlesinger, Uber Gauss Funktionentheoretische Arbeiten, in [56, X.2, 990].
104. Arnold SchOnhage und Volker Strassen, Schnelle Multiplikation grofJer Zahlen,
Computing 7 (1971), 281-292.
(Cited on p. 141, 147, 217)
105. Arnold SchOnhage, A. F. W. Grotefeld/E. Vetter, Fast Algorithms, A Multitape Turing Machine Implementation, BI Wissenschaftsverlag, Mannheim,
1994.
(Cited on p. 92, 236)
106. D. Shanks and J. W. Wrench, Calculation of Pi to 100,000 Decimals, Mathematics of Computation, vol. 16 (1962), 76-79, also in [20, p. 326-329].
(Cited on p. 49, 197)
107. Daniel Shanks, Dihedral Quartic Approximations and Series for 71", Journal of
Number Theory 14(1982), 397-423.
(Cited on p. 62)
108. Daniel Shanks, Improving an Approximation for Pi, American Mathematical
Monthly, Vol. 99 (1992) No.3, 263.
(Cited on p. 49)
109. Allen Shields, Klein and Bieberbach, Mathematics, Race, and Biology, The
Mathematical Intelligencer, Vol. 10 (1988), No.3, 7-11.
(Cited on p. 214)
110. David Singmaster, The legal values of 71", The Mathematical Intelligencer,
Vol. 7 (1985), No.2, 69-72, also in [20, pp. 236-239].
(Cited on p. 213)
111. M.D. Stern, A Remarkable Approximation to 71", The Mathematical Gazette,
Vol. 69 (1985), 218-219, also in [20, pp. 460-461].
(Cited on p. 169)
264
Bibliography
112. Lutz von Strassnitzky, Der Kreis-Umfang fur den Durchmesser 1 auf 200 Decimalstellen berechnet von Herrn Z. Dahse in Wien. Journal fUr die reine und
angewandte Mathematik, Ed 27, 1844, 198.
(Cited on p. 194)
113. D. Takahasi, Y. Kanada, Calculation of Pi to 51.5 Billion Decimal Digits
on Distributed Memory and Parallel Processors, Transactions of Information
Processing Society of Japan, Vol. 39, No.7, (1998).
(Cited on p. 201, 206)
114. Johannes Tropfke, Geschichte der Elementarmathematik, Vierter Band,
Ebene Geometrie, Dritte Aufiage, Walter De Gruyter & Co, 1940.
(Cited on p. 73, 165, 166, 169, 171, 175, 176, 182, 183, 187, 189, 224, 228,
231, 232, 235)
115. Franciscus Vieta (Francpis Viete), Variorum de Rebus Mathematicis, 1593,
Caput XVIII, 400, auch (tw.) in [20, p. 53-56].
(Cited on p. 187)
116. Alexei Volkov, Zhao Youquin and His Calculation of7r, Historia Mathematica,
Vol. 24, No.3, August 1997, 301-331.
(Cited on p. 179)
117. Stan Wagon, Is 7r Normal? The Mathematical Intelligencer, Vol. 7 (1985),
No.3, 65-67, also in [20, pp. 557-559].
(Cited on p. 23)
118. Sebastian Wedeniwski, Piologie, Eine exakte arithmetische Bibliothek in
C++, Edition 1.3, http://www.hipilib.de/
(Cited on p. 234)
119. David Wells, The Penguin Dictionary of Curious and Interesting Numbers,
Penguin Books, Middlesex, 1986.
(Cited on p. 195)
120. David Wells, Are These the Most Beautiful? The Mathematical Intelligencer,
Vol. 12, No.3, 37-41.
(Cited on p. 190)
121. Jet Wimp, Book Review of Pi and the AGM in SIAM Review, Oct. 1988,
530-533.
(Cited on p. 116)
122. J. W. Wrench, Jr., The evolution of extended decimal approximations to 7r,
The Mathematics Teacher, vol. 53 (Dec. 1960), 544-650. also in [20, p. 319325].
(Cited on p. 73, 196)
123. Robert M. Young, Probability, pi, and the primes, Serendipity and experimentation in elementary calculus, The Mathematical Gazette, Vol. 82 (Nov.
1998), 443-451.
(Cited on p. 9)
Index
163 phenomenon, 25
Abel, 95, 98, 109
ADA,118
Ada of Lovelace, 118
Adamchik, 19, 126, 203, 227
AGM,87-102
- basic features, 90
- rule, 88
Aitken, 25
Al-Khashi, 182, 205
algebra, 180
algorithm, 180
- Archimedes, 235
- BBP, 119
- binsplit, 215, 216, 218
- Borwein
cubic, 237
nonic,238
quadratic, 114, 236
quartic, 114, 237
quintic, 111, 237
- dartboard, 39
- Descartes, 235
- Gauss AGM, 77, 90, 91, 93, 114, 119,
200, 236
- Kabus,64
- spigot, 77
- sumalt, 150
Alkarism, 180, 205
Andersson, 153
Andrews, 109
Antiphon, 170
approximation
- Archimedes, 52, 171
- Borweins, 59, 62
- Castellanos, 59
- Plouffe, 60
- Ramanujan, 57, 58
- Shanks, 62
- Tsu Chhung-Chih, 52, 179
approximations for 7r, 51-64
Archimedes, 15,69,170-177,205,235
arctan relations, 232-234
Arcus Tangens, 69-76
Aristophanes, 7
arithmetic, 131-152
arithmetic-geometric mean see AGM
87
Arndt, 75, 76, 110, 233, 234
Aryabhata, 56, 179, 205
Au-Yeung, 235
Babylon, 69, 167, 205
Backhouse, 234
Bailey, 19, 117, 123,202,206, 207, 227,
235
Ball,41
Barrow, 166
Bauer, 55, 61, 228
Bayes, 21
BBP algorithm, 117-129
BBP series, 118, 119
BBP-like series, 227-228
Beckmann, 188, 191, 194, 195
Bellard, 127, 128, 207, 227, 229, 234
Berggren, 115
Berndt, 105, 109
Bernoulli, Jakob, 96, 191
Bernoulli, Johann, 96, 166, 191
"best (arctan) formula", 74
Bible, 4, 51, 169, 205
Bieberbach, 213
binary modulo exponentiation, 120
binsplit algorithm, 215, 216, 218
bit recursion, 48, 235
Blatner, 201
Borwein, J., 30, 48
Borwein, J. and P., 11, 17,59,63,111,
113, 114, 157, 200, 229, 230, 236-238
- algorithm
- - cubic, 237
nonie, 238
-- quadratic, 236
266
Index
C/C++
- e2 , 67
program
- 71" approximation using dartboard
algorithm, 40
- 71" approximation using test for
coprimality, 42
- BBP algorithm, 123, 124
- fast Fourier transform (FFT)
multiplication, 141
- fft () fast Fourier transform, 143
- obfuscated (Roemer), 36
- obfuscated (Westley), 35
- sft 0 slow Fourier transform, 140
- spigot algorithm for 71" (1 digit per
pass), 81
- spigot algorithm for 71" (4 digits per
pass), 83
- spigot algorithm for 71", short form, 37
- spigot algorithm for e, 85
Cadaeic cadenza, 45
Carr, 106
Carroll, 46, 72
Castellanos, 59, 60
Catalan, 229
Cataldi,64
CECM,113
Ceulen see Ludolph van Ceulen 182
CfToNumber 0, 66
Chandah-sutra, 121
Cheops pyramid, 211
Chephren pyramid, 211
2
X test, 23, 29
China, 176
Choresmia, 180
Chronicles, Book of, 169
Chudnovsky, D. and G., 1, 2, 33, 110,
111, 201, 206, 230
circle, squaring the, 7, 170, 196
Clausen, 205
Cohen, 150
compass and straight edge, 7, 98, 170
Ve, 67
e, 11, 14, 25, 32, 37, 60, 67, 84, 85, 116,
189, 190, 202
- series for spigot algorithm, 84
e mathematics, 116
e 2 ,67
educational poems, 44-47
Egypt, 69, 167, 205, 210
elastic curve, 96, 97
Eratosthenes, 38
error distribution curve, 10
Escott, 73, 232
Euclid, 170
euclid (), 42
Euclidean algorithm, 42
Index
267
Jacobi, 95
Japan, 194
Java program
- spigot algorithm for
Jeans, 44
Jeenel,206
Johnson, 198
Jones, 165, 193
The Joy of 7T, 201
Jugend forscht, 63
Jyesttha-devan, 186
7T,
77
Kabus, 63, 64
Kanada, 1, 11, 12, 17, 20, 28, 114, 200,
206
Kanigel, 105
Karana-Paddhati, 185
Karatsuba, 132
268
Index
Index
Jr
Jr
Runge, 199
Rutherford, 194, 205
Sadratnamala, 185
Sagan, 14
Salamin, 87, 102, 200, 231, 236
Salomon, 169
Sastras, 185
Schonhage, 92, 236
series calculation, 150
Shakespeare, 46
Shanks, D., 49, 62, 197, 206
Shanks, W., 50, 195, 205
Sharp, 189, 205, 228
shortcuts to Jr, 35-50
sieve procedure, 38
Simon Fraser University, ll3
Singmaster, 213
slide rule, 136
Smith,205
Snell, 50, 178, 183, 205
spigot algorithm
- faster variant, 82
- pseudocode, 80
spigot algorithms, 77-85
Spring, 107
square root calculation, 146
squaring the circle, 7, 170, 181, 196
- with holes, 162
state of pi art, 1-20
Stern, 169, 231
Stieltjes, 67
Stifel, 196
Stirling, 61, 97, 229
Strassnitzky, 194, 232
St!15rmer, 73, 197, 232, 233
Sulvasutras, 168
sumalt algorithm, 150
symbol Jr, 165
tables, 239-245
Takahashi, 1, 206
Takebe, 194, 230
Tamura, 206
Tanta Sangraham, 185
tertium non datur, 30
theta functions, 95
time needed by world records, 206
transcendence of Jr, 5, 197
Tropfke, 169, 171, 180
Tsu Chhung-Chih, 5, 178, 205
Tukey, 137, 198
Umasvati, 169
269
270
Index
VViles, 7
VVilliams, 26
VVinter, 37
world records, 12
- list of, 205-207
VVrench Jr., 197, 205, 206, 232
VVVVVV, 11
Yoshino, 206
Yukti-Bhasa, 185
Yukti-Dipika, 185
Zagier, 150
zeta function (8),234
Zhang Heng, 56,176,205
Zimmermann, 8
Zoser pyramid, 211
Zu Chongzhi see Tsu Chhung-Chih 178
Jorg Arndt
Christoph Haenel
UNLEASHED
Never in the 4000-year history of research into n
have results been so prolific as at present. In their
book Jorg Arndt and Christoph Haenel describe
the latest and most fascinating findings of
mathematicians and computer scientists in the
field of n.Attention is focussed on new methods
of computation whose speed outstrips that of
predecessor methods by orders of magnitude.
The book comes with a CD-ROM containing not
only the source code of all programs described,
but also related texts and even complete libraries.
415,
-31415
) += "*_3_ 14
141S
-3-1 1
) :t+-.314= 314
14159 && *
1, 3 1415 =
314+(- 31415
while -(-++ *
)* 3 141--=0
j
) ; { char *
write (<3,1),
3,1415926535897932384626433832795028841971693993751058209749
3.1415926: }
31415<314131415% 314-(
31415
] +
T 3]+1)- 314;
,_3141592654)}
ISBN 3-540-66572-2
http://www.springer.de