Hostname: page-component-586b7cd67f-g8jcs Total loading time: 0 Render date: 2024-11-22T05:26:27.688Z Has data issue: false hasContentIssue false

FUNCTIONAL PEARL Calculating the Sieve of Eratosthenes

Published online by Cambridge University Press:  27 October 2004

LAMBERT MEERTENS
Affiliation:
Kestrel Institute, Palo Alto, CA, USA and Utrecht University, Utrecht, The Netherlands (email: [email protected])
Rights & Permissions [Opens in a new window]

Extract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

The Sieve of Eratosthenes is an efficient algorithm for computing the successive primes. Rendered informally, it is as follows:

1. Write down the successive “plurals”: 2, 3, 4, …

2. Repeat:

(a) Take the first number that is not circled or crossed out.

(b) Circle it.

(c) Cross out its proper multiples.

3. What is left (i.e. the circled numbers) are the successive prime numbers.

Type
Functional pearls
Copyright
© 2004 Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.