Visualizing the Sieve of Eratosthenes David N
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
By Sieving, Primality Testing, Legendre's Formula and Meissel's
Computation of π(n) by Sieving, Primality Testing, Legendre’s Formula and Meissel’s Formula Jason Eisner, Spring 1993 This was one of several optional small computational projects assigned to undergraduate mathematics students at Cambridge University in 1993. I’m releasing my code and writeup in 2002 in case they are helpful to anyone—someone doing research in this area wrote to me asking for them. My linear-time version of the Sieve of Eratosthenes may be original; I have not seen that algorithm anywhere else. But the rest of this work is straightforward implementation and exposition of well-known methods. A good reference is H. Riesel, Prime Numbers and Computer Methods for Factorization. My Common Lisp implementation is in the file primes.lisp. The standard language reference (now available online for free) is Guy L. Steele, Jr., Common Lisp: The Language, 2nd ed., Digital Press, 1990. Note: In my discussion of running time, I have adopted the usual ideal- ization of a machine that can perform addition and multiplication operations in constant time. Real computers obviously fall short of this ideal; for exam- ple, when n and m are represented in base 2 by arbitrary length bitstrings, it takes time O(log n log m) to compute nm. Introduction: In this project we’ll look at several approaches for find- ing π(n), the numberof primes less than n. Each approach has its advan- tages. • Sieving produces a complete list of primes that can be further analyzed. For instance, after sieving, we may easily identify the 8169 pairs of twin primes below 106. -
Implementing Eratosthenes' Discovery in the Classroom: Educational
Implementing Eratosthenes’ Discovery in the Classroom: Educational Difficulties Needing Attention Nicolas Decamp, C. de Hosson To cite this version: Nicolas Decamp, C. de Hosson. Implementing Eratosthenes’ Discovery in the Classroom: Educational Difficulties Needing Attention. Science and Education, Springer Verlag, 2012, 21 (6), pp.911-920. 10.1007/s11191-010-9286-3. hal-01663445 HAL Id: hal-01663445 https://hal.archives-ouvertes.fr/hal-01663445 Submitted on 18 Dec 2017 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Sci & Educ DOI 10.1007/s11191-010-9286-3 Implementing Eratosthenes’ Discovery in the Classroom: Educational Difficulties Needing Attention Nicolas De´camp • Ce´cile de Hosson Ó Springer Science+Business Media B.V. 2010 Abstract This paper presents a critical analysis of the accepted educational use of the method performed by Eratosthenes to measure the circumference of Earth which is often considered as a relevant means of dealing with issues related to the nature of science and its history. This method relies on a number of assumptions among which the parallelism of sun rays. The assumption of sun rays parallelism (if it is accurate) does not appear spontaneous for students who consider sun rays to be divergent. -
Primes and Primality Testing
Primes and Primality Testing A Technological/Historical Perspective Jennifer Ellis Department of Mathematics and Computer Science What is a prime number? A number p greater than one is prime if and only if the only divisors of p are 1 and p. Examples: 2, 3, 5, and 7 A few larger examples: 71887 524287 65537 2127 1 Primality Testing: Origins Eratosthenes: Developed “sieve” method 276-194 B.C. Nicknamed Beta – “second place” in many different academic disciplines Also made contributions to www-history.mcs.st- geometry, approximation of andrews.ac.uk/PictDisplay/Eratosthenes.html the Earth’s circumference Sieve of Eratosthenes 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 Sieve of Eratosthenes We only need to “sieve” the multiples of numbers less than 10. Why? (10)(10)=100 (p)(q)<=100 Consider pq where p>10. Then for pq <=100, q must be less than 10. By sieving all the multiples of numbers less than 10 (here, multiples of q), we have removed all composite numbers less than 100. -
Astronomy and Hipparchus
CHAPTER 9 Progress in the Sciences: Astronomy and Hipparchus Klaus Geus Introduction Geography in modern times is a term which covers several sub-disciplines like ecology, human geography, economic history, volcanology etc., which all con- cern themselves with “space” or “environment”. In ancient times, the definition of geography was much more limited. Geography aimed at the production of a map of the oikoumene, a geographer was basically a cartographer. The famous scientist Ptolemy defined geography in the first sentence of his Geographical handbook (Geog. 1.1.1) as “imitation through drafting of the entire known part of the earth, including the things which are, generally speaking, connected with it”. In contrast to chorography, geography uses purely “lines and label in order to show the positions of places and general configurations” (Geog. 1.1.5). Therefore, according to Ptolemy, a geographer needs a μέθοδος μαθεματική, abil- ity and competence in mathematical sciences, most prominently astronomy, in order to fulfil his task of drafting a map of the oikoumene. Given this close connection between geography and astronomy, it is not by default that nearly all ancient “geographers” (in the limited sense of the term) stood out also as astronomers and mathematicians: Among them Anaximander, Eudoxus, Eratosthenes, Hipparchus, Poseidonius and Ptolemy are the most illustrious. Apart from certain topics like latitudes, meridians, polar circles etc., ancient geography also took over from astronomy some methods like the determina- tion of the size of the earth or of celestial and terrestrial distances.1 The men- tioned geographers Anaximander, Eudoxus, Hipparchus, Poseidonius and Ptolemy even constructed instruments for measuring, observing and calculat- ing like the gnomon, sundials, skaphe, astrolabe or the meteoroscope.2 1 E.g., Ptolemy (Geog. -
1.1 Eratosthenes Measures the Earth (Copyright: Bryan Dorner All Rights Reserved)
1.1 Eratosthenes Measures the Earth (Copyright: Bryan Dorner all rights reserved) How big is the Earth? The mathematician Eratosthenes (276-195 BCE) lived in the city of Alexandria in northern Egypt near the place where the Nile river empties into the Mediterranean. Eratosthenes was chief librarian at the Alexandria museum and one of the foremost scholars of the day - second only to Archimedes (who many consider one of the two or three best mathematicians ever to have lived). The city of Alexandria had been founded about one hundred years earlier by Alexander the Great whose conquests stretched from Egypt, through Syria, Babylonia, and Persia to northern India and central Asia. As the Greeks were also called Hellenes, the resulting empire was known as the Hellenistic empire and the following period in which Greek culture was dominant is called the Hellenistic age. The Hellenistic age saw a considerable exchange of culture between the conquering Greeks and the civilizations of the lands they controlled. It is from about this period that the predominantly geometric mathematics of the Greeks shows a computational aspect borrowed from the Babylonians. Some of the best mathematics we have inherited comes from just such a blend of contributions from diverse cultures. Eratosthenes is known for his simple but accurate measurement of the size of the earth. The imprint of Babylon (modern Iraq) as well as Greece can be seen in his method. He did not divide the arc of a circle into 360 parts as the Babylonians did, but into 60 equal parts. Still, the use of 60 reveals the influence of the Babylonian number system - the sexagesimal system - which was based on the number 60 in the same way ours is based on the number 10. -
Primality Testing for Beginners
STUDENT MATHEMATICAL LIBRARY Volume 70 Primality Testing for Beginners Lasse Rempe-Gillen Rebecca Waldecker http://dx.doi.org/10.1090/stml/070 Primality Testing for Beginners STUDENT MATHEMATICAL LIBRARY Volume 70 Primality Testing for Beginners Lasse Rempe-Gillen Rebecca Waldecker American Mathematical Society Providence, Rhode Island Editorial Board Satyan L. Devadoss John Stillwell Gerald B. Folland (Chair) Serge Tabachnikov The cover illustration is a variant of the Sieve of Eratosthenes (Sec- tion 1.5), showing the integers from 1 to 2704 colored by the number of their prime factors, including repeats. The illustration was created us- ing MATLAB. The back cover shows a phase plot of the Riemann zeta function (see Appendix A), which appears courtesy of Elias Wegert (www.visual.wegert.com). 2010 Mathematics Subject Classification. Primary 11-01, 11-02, 11Axx, 11Y11, 11Y16. For additional information and updates on this book, visit www.ams.org/bookpages/stml-70 Library of Congress Cataloging-in-Publication Data Rempe-Gillen, Lasse, 1978– author. [Primzahltests f¨ur Einsteiger. English] Primality testing for beginners / Lasse Rempe-Gillen, Rebecca Waldecker. pages cm. — (Student mathematical library ; volume 70) Translation of: Primzahltests f¨ur Einsteiger : Zahlentheorie - Algorithmik - Kryptographie. Includes bibliographical references and index. ISBN 978-0-8218-9883-3 (alk. paper) 1. Number theory. I. Waldecker, Rebecca, 1979– author. II. Title. QA241.R45813 2014 512.72—dc23 2013032423 Copying and reprinting. Individual readers of this publication, and nonprofit libraries acting for them, are permitted to make fair use of the material, such as to copy a chapter for use in teaching or research. Permission is granted to quote brief passages from this publication in reviews, provided the customary acknowledgment of the source is given. -
9 · the Growth of an Empirical Cartography in Hellenistic Greece
9 · The Growth of an Empirical Cartography in Hellenistic Greece PREPARED BY THE EDITORS FROM MATERIALS SUPPLIED BY GERMAINE AUJAe There is no complete break between the development of That such a change should occur is due both to po cartography in classical and in Hellenistic Greece. In litical and military factors and to cultural developments contrast to many periods in the ancient and medieval within Greek society as a whole. With respect to the world, we are able to reconstruct throughout the Greek latter, we can see how Greek cartography started to be period-and indeed into the Roman-a continuum in influenced by a new infrastructure for learning that had cartographic thought and practice. Certainly the a profound effect on the growth of formalized know achievements of the third century B.C. in Alexandria had ledge in general. Of particular importance for the history been prepared for and made possible by the scientific of the map was the growth of Alexandria as a major progress of the fourth century. Eudoxus, as we have seen, center of learning, far surpassing in this respect the had already formulated the geocentric hypothesis in Macedonian court at Pella. It was at Alexandria that mathematical models; and he had also translated his Euclid's famous school of geometry flourished in the concepts into celestial globes that may be regarded as reign of Ptolemy II Philadelphus (285-246 B.C.). And it anticipating the sphairopoiia. 1 By the beginning of the was at Alexandria that this Ptolemy, son of Ptolemy I Hellenistic period there had been developed not only the Soter, a companion of Alexander, had founded the li various celestial globes, but also systems of concentric brary, soon to become famous throughout the Mediter spheres, together with maps of the inhabited world that ranean world. -
The Pollard's Rho Method for Factoring Numbers
Foote 1 Corey Foote Dr. Thomas Kent Honors Number Theory Date: 11-30-11 The Pollard’s Rho Method for Factoring Numbers We are all familiar with the concepts of prime and composite numbers. We also know that a number is either prime or a product of primes. The Fundamental Theorem of Arithmetic states that every integer n ≥ 2 is either a prime or a product of primes, and the product is unique apart from the order in which the factors appear (Long, 55). The number 7, for example, is a prime number. It has only two factors, itself and 1. On the other hand 24 has a prime factorization of 2 3 × 3. Because its factors are not just 24 and 1, 24 is considered a composite number. The numbers 7 and 24 are easier to factor than larger numbers. We will look at the Sieve of Eratosthenes, an efficient factoring method for dealing with smaller numbers, followed by Pollard’s rho, a method that allows us how to factor large numbers into their primes. The Sieve of Eratosthenes allows us to find the prime numbers up to and including a particular number, n. First, we find the prime numbers that are less than or equal to √͢. Then we use these primes to see which of the numbers √͢ ≤ n - k, ..., n - 2, n - 1 ≤ n these primes properly divide. The remaining numbers are the prime numbers that are greater than √͢ and less than or equal to n. This method works because these prime numbers clearly cannot have any prime factor less than or equal to √͢, as the number would then be composite. -
10 · Greek Cartography in the Early Roman World
10 · Greek Cartography in the Early Roman World PREPARED BY THE EDITORS FROM MATERIALS SUPPLIED BY GERMAINE AUJAe The Roman republic offers a good case for continuing to treat the Greek contribution to mapping as a separate CONTINUITY AND CHANGE IN THEORETICAL strand in the history ofclassical cartography. While there CARTOGRAPHY: POLYBIUS, CRATES, was a considerable blending-and interdependence-of AND HIPPARCHUS Greek and Roman concepts and skills, the fundamental distinction between the often theoretical nature of the Greek contribution and the increasingly practical uses The extent to which a new generation of scholars in the for maps devised by the Romans forms a familiar but second century B.C. was familiar with the texts, maps, satisfactory division for their respective cartographic in and globes of the Hellenistic period is a clear pointer to fluences. Certainly the political expansion of Rome, an uninterrupted continuity of cartographic knowledge. whose domination was rapidly extending over the Med Such knowledge, relating to both terrestrial and celestial iterranean, did not lead to an eclipse of Greek influence. mapping, had been transmitted through a succession of It is true that after the death of Ptolemy III Euergetes in well-defined master-pupil relationships, and the pres 221 B.C. a decline in the cultural supremacy of Alex ervation of texts and three-dimensional models had been andria set in. Intellectual life moved to more energetic aided by the growth of libraries. Yet this evidence should centers such as Pergamum, Rhodes, and above all Rome, not be interpreted to suggest that the Greek contribution but this promoted the diffusion and development of to cartography in the early Roman world was merely a Greek knowledge about maps rather than its extinction. -
The I/O Complexity of Computing Prime Tables 1 Introduction
The I/O Complexity of Computing Prime Tables Michael A. Bender1, Rezaul Chowdhury1, Alex Conway2, Mart´ın Farach-Colton2, Pramod Ganapathi1, Rob Johnson1, Samuel McCauley1, Bertrand Simon3, and Shikha Singh1 1 Stony Brook University, Stony Brook, NY 11794-2424, USA. fbender,rezaul,pganapathi,rob,smccauley,shiksinghg @cs.stonybrook.edu 2 Rutgers University, Piscataway, NJ 08854, USA. ffarach,[email protected] 3 LIP, ENS de Lyon, 46 allee´ d’Italie, Lyon, France. [email protected] Abstract. We revisit classical sieves for computing primes and analyze their performance in the external-memory model. Most prior sieves are analyzed in the RAM model, where the focus is on minimizing both the total number of operations and the size of the working set. The hope is that if the working set fits in RAM, then the sieve will have good I/O performance, though such an outcome is by no means guaranteed by a small working-set size. We analyze our algorithms directly in terms of I/Os and operations. In the external- memory model, permutation can be the most expensive aspect of sieving, in contrast to the RAM model, where permutations are trivial. We show how to implement classical sieves so that they have both good I/O performance and good RAM performance, even when the problem size N becomes huge—even superpolynomially larger than RAM. Towards this goal, we give two I/O-efficient priority queues that are optimized for the operations incurred by these sieves. Keywords: External-Memory Algorithms, Prime Tables, Sorting, Priority Queues 1 Introduction According to Fox News [21], “Prime numbers, which are divisible only by themselves and one, have little mathematical importance. -
Math 105 History of Mathematics
Math 105 History of Mathematics Second Test Prof. D. Joyce, November, 2010 You may refer to one sheet of notes on this test, and you may use a calculator if you like. Points for each problem are in square brackets. Start your answers to each problem on a separate page page of the bluebook. Please write or print clearly. Problem 1. Essay. [25] Select one of the two topics A or B. Please think about these topics and make an outline before you begin writing. You will be graded on how well you present your ideas as well as your ideas themselves. Each essay should be relatively short|one to three written pages. There should be no fluff in your essays. Make your essays well-structured and your points as clearly as you can. Topic A. One quality of the mathematics of ancient India and China, on the one hand, which differs from that of Greek and Islamic/Arabic mathematicians, on the other hand, is formalism. Here formalism means careful definitions and clear proofs. (Another aspect of for- malism which doesn't have much role here is symbolism, as in symbolic algebra which wasn't developed until later.) Explain what this difference is and describe the role of formalism in the development of mathematics in those cultures. Topic B. Trigonometry was part of the mathematical knowledge in several regions: Greece, India, China, and Islamic/Arabic. Briefly describe the trigonometry of each in a sentence or two. Describe how knowledge of trigonometry passed among these cultures. Problem 2. [21; 7 points each part] On the Chinese algorithm for solving polynomial equations. -
THE SIEVE of ERATOSTHENES an Ancient Greek Mathematician by the Name of Eratosthenes of Cyrene (C
THE SIEVE OF ERATOSTHENES An ancient Greek mathematician by the name of Eratosthenes of Cyrene (c. 200 B.C.) developed an algorithm for finding prime numbers that has come to be known as the Sieve of Eratosthenes. Eratosthenes’s Sieve 1. Create a sieve containing all the integers from 2 through n. 2. Remove the nonprime integers from the sieve by removing the multiples of 2, of 3, of 5, and so on, until reaching n . 3. Only primes will remain in the sieve. Let’s design a Java program that uses this algorithm. We’ll follow the programming methodology How to Invent an Algorithm.1 How to Invent an Algorithm Step What? How? 1 Understand the problem Use pencil and paper to solve the problem by hand. by solving it Let n = 35. Create a sieve containing 2 through 35: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Remove the multiples of 2: 2 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 The multiples of 3: 2 3 5 7 11 13 17 19 23 25 29 31 35 The multiples of 5: 2 3 5 7 11 13 17 19 23 29 31 7 > 5.92 = 35 , so we’re done. The numbers left are all prime. 1 Programming 101 ‒ Algorithm Development → How to Invent an Algorithm, p. 1. And Programming 101 ‒ Algorithm Development → Help for Beginners, p.