Prime numbers (Eratosthenes)
From: JS (dsa._at_asdf.com)
Date: 12/29/04
- Next message: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Previous message: Ryan Stewart: "Re: Tomcat classpath"
- Next in thread: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Reply: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Dec 2004 22:05:42 +0100
I need to implement the following algorithm where P needs to be modelled af
an array of booleans ( booleans[]P = new boolean[n + 1]).
But how do I write this in the {} thats gonna be executed as long as 2*i<=
n??
for (i = 2; 2*i <=n; i = i + 1)
//{remove from P all multiples of i};
//print the contents of P
- Next message: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Previous message: Ryan Stewart: "Re: Tomcat classpath"
- Next in thread: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Reply: Stefan Schulz: "Re: Prime numbers (Eratosthenes)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]