Share on Facebook Share on Twitter Email
Answers.com

Sieve of Sundaram

 
Wikipedia: Sieve of Sundaram

In mathematics, the sieve of Sundaram is a simple deterministic algorithm for finding all prime numbers up to a specified integer. It was discovered by an Indian student S. P. Sundaram from Sathyamangalam in 1934.[1][2]

Contents

Algorithm

Start with a list of the integers from 1 to n. From this list, remove all numbers of the form of i + j + 2ij where:

  • i, j \in \mathbb{N}^*
  • \frac{n - i}{1+2i} \ge j\, (which can be found by manipulating ni + j + 2ij)

The remaining numbers are doubled and incremented by one, giving a list of the odd prime numbers (i.e., all primes except the only even prime 2).

Correctness

If the expression i + j + 2ij is doubled and incremented, we have

2(i + j + 2ij) + 1

= 2i + 2j + 4ij + 1

= (2i + 1)(2j + 1).

Thus all the numbers excluded from the doubled-and-incremented list are composite, because both factors in (2i + 1)(2j + 1) are greater than 1. If a number is prime, it cannot be placed into that factorization for any positive i, j, and so is left in the list.

Computational complexity

The sieve of Sundaram finds the primes less than n in Θ(n log n) operations using Θ(n) bits of memory.

See also

References

  1. ^ V. Ramaswami Aiyar (1934). "Sundaram's Sieve for Prime Numbers". The Mathematics Student 2 (2): 73. ISSN 0025-5742. 
  2. ^ G. (1941). "Curiosa 81. A New Sieve for Prime Numbers". Scripta Mathematica 8 (3): 164. 

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Sieve of Sundaram" Read more