Computing the Digits in Π
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
Computation of 2700 Billion Decimal Digits of Pi Using a Desktop Computer
Computation of 2700 billion decimal digits of Pi using a Desktop Computer Fabrice Bellard Feb 11, 2010 (4th revision) This article describes some of the methods used to get the world record of the computation of the digits of π digits using an inexpensive desktop computer. 1 Notations We assume that numbers are represented in base B with B = 264. A digit in base B is called a limb. M(n) is the time needed to multiply n limb numbers. We assume that M(Cn) is approximately CM(n), which means M(n) is mostly linear, which is the case when handling very large numbers with the Sch¨onhage-Strassen multiplication [5]. log(n) means the natural logarithm of n. log2(n) is log(n)/ log(2). SI and binary prefixes are used (i.e. 1 TB = 1012 bytes, 1 GiB = 230 bytes). 2 Evaluation of the Chudnovsky series 2.1 Introduction The digits of π were computed using the Chudnovsky series [10] ∞ 1 X (−1)n(6n)!(A + Bn) = 12 π (n!)3(3n)!C3n+3/2 n=0 with A = 13591409 B = 545140134 C = 640320 . It was evaluated with the binary splitting algorithm. The asymptotic running time is O(M(n) log(n)2) for a n limb result. It is worst than the asymptotic running time of the Arithmetic-Geometric Mean algorithms of O(M(n) log(n)) but it has better locality and many improvements can reduce its constant factor. Let S be defined as n2 n X Y pk S(n1, n2) = an . qk n=n1+1 k=n1+1 1 We define the auxiliary integers n Y2 P (n1, n2) = pk k=n1+1 n Y2 Q(n1, n2) = qk k=n1+1 T (n1, n2) = S(n1, n2)Q(n1, n2). -
Course Notes 1 1.1 Algorithms: Arithmetic
CS 125 Course Notes 1 Fall 2016 Welcome to CS 125, a course on algorithms and computational complexity. First, what do these terms means? An algorithm is a recipe or a well-defined procedure for performing a calculation, or in general, for transform- ing some input into a desired output. In this course we will ask a number of basic questions about algorithms: • Does the algorithm halt? • Is it correct? That is, does the algorithm’s output always satisfy the input to output specification that we desire? • Is it efficient? Efficiency could be measured in more than one way. For example, what is the running time of the algorithm? What is its memory consumption? Meanwhile, computational complexity theory focuses on classification of problems according to the com- putational resources they require (time, memory, randomness, parallelism, etc.) in various computational models. Computational complexity theory asks questions such as • Is the class of problems that can be solved time-efficiently with a deterministic algorithm exactly the same as the class that can be solved time-efficiently with a randomized algorithm? • For a given class of problems, is there a “complete” problem for the class such that solving that one problem efficiently implies solving all problems in the class efficiently? • Can every problem with a time-efficient algorithmic solution also be solved with extremely little additional memory (beyond the memory required to store the problem input)? 1.1 Algorithms: arithmetic Some algorithms very familiar to us all are those those for adding and multiplying integers. We all know the grade school algorithm for addition from kindergarten: write the two numbers on top of each other, then add digits right 1-1 1-2 1 7 8 × 2 1 3 5 3 4 1 7 8 +3 5 6 3 7 914 Figure 1.1: Grade school multiplication. -
A Scalable System-On-A-Chip Architecture for Prime Number Validation
A SCALABLE SYSTEM-ON-A-CHIP ARCHITECTURE FOR PRIME NUMBER VALIDATION Ray C.C. Cheung and Ashley Brown Department of Computing, Imperial College London, United Kingdom Abstract This paper presents a scalable SoC architecture for prime number validation which targets reconfigurable hardware This paper presents a scalable SoC architecture for prime such as FPGAs. In particular, users are allowed to se- number validation which targets reconfigurable hardware. lect predefined scalable or non-scalable modular opera- The primality test is crucial for security systems, especially tors for their designs [4]. Our main contributions in- for most public-key schemes. The Rabin-Miller Strong clude: (1) Parallel designs for Montgomery modular arith- Pseudoprime Test has been mapped into hardware, which metic operations (Section 3). (2) A scalable design method makes use of a circuit for computing Montgomery modu- for mapping the Rabin-Miller Strong Pseudoprime Test lar exponentiation to further speed up the validation and to into hardware (Section 4). (3) An architecture of RAM- reduce the hardware cost. A design generator has been de- based Radix-2 Scalable Montgomery multiplier (Section veloped to generate a variety of scalable and non-scalable 4). (4) A design generator for producing hardware prime Montgomery multipliers based on user-defined parameters. number validators based on user-specified parameters (Sec- The performance and resource usage of our designs, im- tion 5). (5) Implementation of the proposed hardware ar- plemented in Xilinx reconfigurable devices, have been ex- chitectures in FPGAs, with an evaluation of its effective- plored using the embedded PowerPC processor and the soft ness compared with different size and speed tradeoffs (Sec- MicroBlaze processor. -
On the Normality of Numbers
ON THE NORMALITY OF NUMBERS Adrian Belshaw B. Sc., University of British Columbia, 1973 M. A., Princeton University, 1976 A THESIS SUBMITTED 'IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in the Department of Mathematics @ Adrian Belshaw 2005 SIMON FRASER UNIVERSITY Fall 2005 All rights reserved. This work may not be reproduced in whole or in part, by photocopy or other means, without the permission of the author. APPROVAL Name: Adrian Belshaw Degree: Master of Science Title of Thesis: On the Normality of Numbers Examining Committee: Dr. Ladislav Stacho Chair Dr. Peter Borwein Senior Supervisor Professor of Mathematics Simon Fraser University Dr. Stephen Choi Supervisor Assistant Professor of Mathematics Simon Fraser University Dr. Jason Bell Internal Examiner Assistant Professor of Mathematics Simon Fraser University Date Approved: December 5. 2005 SIMON FRASER ' u~~~snrllbrary DECLARATION OF PARTIAL COPYRIGHT LICENCE The author, whose copyright is declared on the title page of this work, has granted to Simon Fraser University the right to lend this thesis, project or extended essay to users of the Simon Fraser University Library, and to make partial or single copies only for such users or in response to a request from the library of any other university, or other educational institution, on its own behalf or for one of its users. The author has further granted permission to Simon Fraser University to keep or make a digital copy for use in its circulating collection, and, without changing the content, to translate the thesislproject or extended essays, if technically possible, to any medium or format for the purpose of preservation of the digital work. -
The Number of Solutions of Φ(X) = M
Annals of Mathematics, 150 (1999), 1–29 The number of solutions of φ(x) = m By Kevin Ford Abstract An old conjecture of Sierpi´nskiasserts that for every integer k > 2, there is a number m for which the equation φ(x) = m has exactly k solutions. Here φ is Euler’s totient function. In 1961, Schinzel deduced this conjecture from his Hypothesis H. The purpose of this paper is to present an unconditional proof of Sierpi´nski’sconjecture. The proof uses many results from sieve theory, in particular the famous theorem of Chen. 1. Introduction Of fundamental importance in the theory of numbers is Euler’s totient function φ(n). Two famous unsolved problems concern the possible values of the function A(m), the number of solutions of φ(x) = m, also called the multiplicity of m. Carmichael’s Conjecture ([1],[2]) states that for every m, the equation φ(x) = m has either no solutions x or at least two solutions. In other words, no totient can have multiplicity 1. Although this remains an open problem, very large lower bounds for a possible counterexample are relatively easy to obtain, the latest being 101010 ([10], Th. 6). Recently, the author has also shown that either Carmichael’s Conjecture is true or a positive proportion of all values m of Euler’s function give A(m) = 1 ([10], Th. 2). In the 1950’s, Sierpi´nski conjectured that all multiplicities k > 2 are possible (see [9] and [16]), and in 1961 Schinzel [17] deduced this conjecture from his well-known Hypothesis H [18]. -
Version 0.5.1 of 5 March 2010
Modern Computer Arithmetic Richard P. Brent and Paul Zimmermann Version 0.5.1 of 5 March 2010 iii Copyright c 2003-2010 Richard P. Brent and Paul Zimmermann ° This electronic version is distributed under the terms and conditions of the Creative Commons license “Attribution-Noncommercial-No Derivative Works 3.0”. You are free to copy, distribute and transmit this book under the following conditions: Attribution. You must attribute the work in the manner specified by the • author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial. You may not use this work for commercial purposes. • No Derivative Works. You may not alter, transform, or build upon this • work. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to the web page below. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author’s moral rights. For more information about the license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ Contents Preface page ix Acknowledgements xi Notation xiii 1 Integer Arithmetic 1 1.1 Representation and Notations 1 1.2 Addition and Subtraction 2 1.3 Multiplication 3 1.3.1 Naive Multiplication 4 1.3.2 Karatsuba’s Algorithm 5 1.3.3 Toom-Cook Multiplication 6 1.3.4 Use of the Fast Fourier Transform (FFT) 8 1.3.5 Unbalanced Multiplication 8 1.3.6 Squaring 11 1.3.7 Multiplication by a Constant 13 1.4 Division 14 1.4.1 Naive -
PRIME-PERFECT NUMBERS Paul Pollack [email protected] Carl
PRIME-PERFECT NUMBERS Paul Pollack Department of Mathematics, University of Illinois, Urbana, Illinois 61801, USA [email protected] Carl Pomerance Department of Mathematics, Dartmouth College, Hanover, New Hampshire 03755, USA [email protected] In memory of John Lewis Selfridge Abstract We discuss a relative of the perfect numbers for which it is possible to prove that there are infinitely many examples. Call a natural number n prime-perfect if n and σ(n) share the same set of distinct prime divisors. For example, all even perfect numbers are prime-perfect. We show that the count Nσ(x) of prime-perfect numbers in [1; x] satisfies estimates of the form c= log log log x 1 +o(1) exp((log x) ) ≤ Nσ(x) ≤ x 3 ; as x ! 1. We also discuss the analogous problem for the Euler function. Letting N'(x) denote the number of n ≤ x for which n and '(n) share the same set of prime factors, we show that as x ! 1, x1=2 x7=20 ≤ N (x) ≤ ; where L(x) = xlog log log x= log log x: ' L(x)1=4+o(1) We conclude by discussing some related problems posed by Harborth and Cohen. 1. Introduction P Let σ(n) := djn d be the sum of the proper divisors of n. A natural number n is called perfect if σ(n) = 2n and, more generally, multiply perfect if n j σ(n). The study of such numbers has an ancient pedigree (surveyed, e.g., in [5, Chapter 1] and [28, Chapter 1]), but many of the most interesting problems remain unsolved. -
Random Number Generation Using Normal Numbers
Random Number Generation Using Normal Numbers Random Number Generation Using Normal Numbers Michael Mascagni1 and F. Steve Brailsford2 Department of Computer Science1;2 Department of Mathematics1 Department of Scientific Computing1 Graduate Program in Molecular Biophysics1 Florida State University, Tallahassee, FL 32306 USA AND Applied and Computational Mathematics Division, Information Technology Laboratory1 National Institute of Standards and Technology, Gaithersburg, MD 20899-8910 USA E-mail: [email protected] or [email protected] or [email protected] URL: http://www.cs.fsu.edu/∼mascagni In collaboration with Dr. David H. Bailey, Lawrence Berkeley Laboratory and UC Davis Random Number Generation Using Normal Numbers Outline of the Talk Introduction Normal Numbers Examples of Normal Numbers Properties Relationship with standard pseudorandom number generators Normal Numbers and Random Number Recursions Normal from recursive sequence Source Code Seed Generation Calculation Code Initial Calculation Code Iteration Implementation and Results Conclusions and Future Work Random Number Generation Using Normal Numbers Introduction Normal Numbers Normal Numbers: Types of Numbers p I Rational numbers - q where p and q are integers I Irrational numbers - not rational I b-dense numbers - α is b-dense () in its base-b expansion every possible finite string of consecutive digits appears I If α is b-dense then α is also irrational; it cannot have a repeating/terminating base-b digit expansion I Normal number - α is b-normal () in its base-b expansion -
1 Multiplication
CS 140 Class Notes 1 1 Multiplication Consider two unsigned binary numb ers X and Y . Wewanttomultiply these numb ers. The basic algorithm is similar to the one used in multiplying the numb ers on p encil and pap er. The main op erations involved are shift and add. Recall that the `p encil-and-pap er' algorithm is inecient in that each pro duct term obtained bymultiplying each bit of the multiplier to the multiplicand has to b e saved till all such pro duct terms are obtained. In machine implementations, it is desirable to add all such pro duct terms to form the partial product. Also, instead of shifting the pro duct terms to the left, the partial pro duct is shifted to the right b efore the addition takes place. In other words, if P is the partial pro duct i after i steps and if Y is the multiplicand and X is the multiplier, then P P + x Y i i j and 1 P P 2 i+1 i and the pro cess rep eats. Note that the multiplication of signed magnitude numb ers require a straight forward extension of the unsigned case. The magnitude part of the pro duct can b e computed just as in the unsigned magnitude case. The sign p of the pro duct P is computed from the signs of X and Y as 0 p x y 0 0 0 1.1 Two's complement Multiplication - Rob ertson's Algorithm Consider the case that we want to multiply two 8 bit numb ers X = x x :::x and Y = y y :::y . -
Divide-And-Conquer Algorithms
Chapter 2 Divide-and-conquer algorithms The divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem 2. Recursively solving these subproblems 3. Appropriately combining their answers The real work is done piecemeal, in three different places: in the partitioning of problems into subproblems; at the very tail end of the recursion, when the subproblems are so small that they are solved outright; and in the gluing together of partial answers. These are held together and coordinated by the algorithm's core recursive structure. As an introductory example, we'll see how this technique yields a new algorithm for multi- plying numbers, one that is much more efficient than the method we all learned in elementary school! 2.1 Multiplication The mathematician Carl Friedrich Gauss (1777–1855) once noticed that although the product of two complex numbers (a + bi)(c + di) = ac bd + (bc + ad)i − seems to involve four real-number multiplications, it can in fact be done with just three: ac, bd, and (a + b)(c + d), since bc + ad = (a + b)(c + d) ac bd: − − In our big-O way of thinking, reducing the number of multiplications from four to three seems wasted ingenuity. But this modest improvement becomes very significant when applied recur- sively. 55 56 Algorithms Let's move away from complex numbers and see how this helps with regular multiplica- tion. Suppose x and y are two n-bit integers, and assume for convenience that n is a power of 2 (the more general case is hardly any different). -
Algorithmic Data Analytics, Small Data Matters and Correlation Versus Causation Arxiv:1309.1418V9 [Cs.CE] 26 Jul 2017
Algorithmic Data Analytics, Small Data Matters and Correlation versus Causation∗ Hector Zenil Unit of Computational Medicine, SciLifeLab, Department of Medicine Solna, Karolinska Institute, Stockholm, Sweden; Department of Computer Science, University of Oxford, UK; and Algorithmic Nature Group, LABORES, Paris, France. Abstract This is a review of aspects of the theory of algorithmic information that may contribute to a framework for formulating questions related to complex, highly unpredictable systems. We start by contrasting Shannon entropy and Kolmogorov-Chaitin complexity, which epit- omise correlation and causation respectively, and then surveying classical results from algorithmic complexity and algorithmic proba- bility, highlighting their deep connection to the study of automata frequency distributions. We end by showing that though long-range algorithmic prediction models for economic and biological systems may require infinite computation, locally approximated short-range estimations are possible, thereby demonstrating how small data can deliver important insights into important features of complex “Big Data”. arXiv:1309.1418v9 [cs.CE] 26 Jul 2017 Keywords: Correlation; causation; complex systems; algorithmic probability; computability; Kolmogorov-Chaitin complexity. ∗Invited contribution to the festschrift Predictability in the world: philosophy and science in the complex world of Big Data edited by J. Wernecke on the occasion of the retirement of Prof. Dr. Klaus Mainzer, Springer Verlag. Chapter based on an invited talk delivered to UNAM-CEIICH via videoconference from The University of Sheffield in the U.K. for the Alan Turing colloquium “From computers to life” http: //www.complexitycalculator.com/TuringUNAM.pdf) in June, 2012. 1 1 Introduction Complex systems have been studied for some time now, but it was not until recently that sampling complex systems became possible, systems ranging from computational methods such as high-throughput biology, to systems with sufficient storage capacity to store and analyse market transactions. -
Normality and the Digits of Π
Normality and the Digits of π David H. Bailey∗ Jonathan M. Borweiny Cristian S. Caludez Michael J. Dinneenx Monica Dumitrescu{ Alex Yeek February 15, 2012 1 Introduction The question of whether (and why) the digits of well-known constants of mathematics are statistically random in some sense has long fascinated mathematicians. Indeed, one prime motivation in computing and analyzing digits of π is to explore the age-old question of whether and why these digits appear \random." The first computation on ENIAC in 1949 of π to 2037 decimal places was proposed by John von Neumann to shed some light on the distribution of π (and of e)[8, pp. 277{281]. Since then, numerous computer-based statistical checks of the digits of π, for instance, so far have failed to disclose any deviation from reasonable statistical norms. See, for instance, Table1, which presents the counts of individual hexadecimal digits among the first trillion hex digits, as obtained by Yasumasa Kanada. By contrast, ∗Lawrence Berkeley National Laboratory, Berkeley, CA 94720. [email protected]. Supported in part by the Director, Office of Computational and Technology Research, Division of Mathemat- ical, Information, and Computational Sciences of the U.S. Department of Energy, under contract number DE-AC02-05CH11231. yCentre for Computer Assisted Research Mathematics and its Applications (CARMA), Uni- versity of Newcastle, Callaghan, NSW 2308, Australia. [email protected]. Distinguished Professor King Abdul-Aziz Univ, Jeddah. zDepartment of Computer Science, University of Auckland, Private Bag 92019, Auckland, New Zealand. [email protected]. xDepartment of Computer Science, University of Auckland, Private Bag 92019, Auckland, New Zealand.