CS 412/413
Introduction to Compilers
Spring 2001

Sieve

Find the number of primes in [2, LIMIT] (LIMIT is currently defined as 8192), N times.  The algorithm used is a naive implementation of the Sieve of Eratosthenes.  This tests the efficiency of several constructs:  arrays, loops, and integer math.

Source: [Sieve.im sieve.cpp Sieve.java]
Input:
N=1000
Output:
The number of primes (1028).

 
C++ 0.26
Java 0.71
B 1.01
C 1.18
D 1.2
G 1.37
E 1.7
A 2.79
H 5.82