Calculation of the Digits of π
|
| (1) |
|
But was there a positional system in which π was known? As S. Rabinovitz has realized, there indeed was such a system albeit an unusual one. The starting point was the series
which also can be written as
or, in the Horner form,
This last expression is a representation of π in a system with a mixed-radix base
Spigot Algorithm for π
- Initialize: Let A = (2, 2, 2, 2,... ,2) be an array of length
[10n/3] + 1. - Repeat n times:
Multiply by 10: Multiply each entry of A by 10.
Put A into regular form: Starting from the right, reduce the ith element of A (corresponding to b-entry(i - 1)/(2i - 1)) modulo2i - 1, to get a quotient q and a remainder r. Leave r in place and carryq(i - 1) one place left. The last integer carried (from the position wherei - 1 = 2) may be as large as 19. - Get the next predigit: Reduce the leftmost entry of A (which is at most 109
(= 9 - 10 + 191)) modulo 10. The quotient, q, is the new predigit of π, the remainder staying in place. - Adjust the predigits: If q is neither 9 nor 10, release the held predigits as true digits of π and hold q. If q is 9, add q to the queue of held predigits. If q is 10 then:
- set the current predigit to 0 and hold it;
- increase all other held predigits by 1(9 becomes 0);
- release as true digits of π all but the current held predigit.
(Rabinovitz and Wagon argued that it takes [10n/3], where [] is the floor function, digits to calculate n decimal digits. Arndt and Haenel found an inaccuracy in their derivation and changed that to [10n/3] + 1, the value used in the applet.)
| Buy this applet What if applet does not run? |
(In the applet "Chunk" and "Font size" are output formatting parameters. The digits of π are grouped into chunks for easy reading. The applet enforces a limitation of 50,000 digits - more than a world record some 50 years ago. Elsewhere there is a faster implementation based on another idea of Rabinovitz and Wagon.)
References
- S. Rabinowitz, Abstract 863-11-482: A spigot algorithm for π, Abstracts Amer. Math. Society 12 (1991) p. 30.
- S. Rabinowitz, S. Wagon, A Spigot Algorithm for the Digits of π, The American Mathematical Monthly, Vol. 102, No. 3. (Mar., 1995), pp. 195-203.
- J. Arndt, C. Haenel, π Unleashed, Springer, 2000
- S. Rabinowitz, S. Wagon, A Spigot Algorithm for the Digits of π, The American Mathematical Monthly, Vol. 102, No. 3. (Mar., 1995), pp. 195-203.
|Activities| |Contact| |Front page| |Contents| |Algebra| |Store|
Copyright © 1996-2012 Alexander Bogomolny
| 40618534 |

