Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Determine Prime Number with the Sieve of Eratosthenes - Algorithm in Java

Lars Vogel

Version 0.1

17.05.2009

Revision History
Revision 0.117.05.2009Lars Vogel
Created

Abstract

This article describes the calculation of prime numbers with the sieve of Eratosthenes in Java


Table of Contents

1. Prime Factorization
2. Implementation in Java
3. Thank you
4. Questions and Discussion
5. Links and Literature
5.1. Source Code
5.2. General

1. Prime Factorization

A prime is an integer greater then one whole only positive divisors are one and itself.

The prime counting function for a number N (also known as pie(N)) is the number of primes less or equal to N.

The following algorithm determines all prime numbers until a certain value.