₦airaland Forum

Welcome, Guest: Register • Login • With Google • Trending • Recent • New

Stats: 3,344,812 members, 8,513,810 topics. Date: Thursday, 05 November 2026 at 02:51 PM

Toggle theme

Joenell's Posts

Nairaland Forum › Joenell's Profile › Joenell's Posts

1 (of 1 pages)

Programming › Sieve Of Eratosthenes by joenell(op): 2:57pm On Nov 25, 2010
Please Guys out there, I need help on the below java programming question that I have been finding difficult to solve for some weeks now!
And the question is:

The sieve of Eratosthenes can be used to determine all prime less than a given integer, n. The methods can be described as follows;
A. Store 1s in element p(1) to p(n) of an array
B. Set f to 2
C. Set to 0 any element of p whose subscript is a multiple of p
D. Set f to the subscript of the next element of p which contain 1
E. Repeat steps C and D until f reaches or equals the square root of n.
The subscripts of those elements containing 1s are prime numbers.

1 (of 1 pages)