This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implementation of the sieve of Eratosthenes for finding all the primes up to | |
* a given number (MAX in this case). | |
* From the command line: | |
* Step 1 (compile): javac PrimesSieve.java | |
* Step 2 (run): java PrimesSieve | |
*/ | |
public class PrimesSieve { | |
public static void main(String[] args) { | |
final int MAX = 1_000_000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
/// Implementation of the sieve of Eratosthenes for finding all the primes up to | |
/// a given number (MAX in this case). | |
/// From the command line: | |
/// Step 1 (Compile): csc PrimesSieve.cs | |
/// Step 2 (Run): .\PrimesSieve | |
public class PrimesSieve { | |
static void Main() { | |
const int MAX = 1000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Implementation of the sieve of Eratosthenes for finding all the primes up to | |
* a given number (MAX in this case). | |
* From the command line: | |
* Step 1 (compile): gcc psieve.c -o psieve | |
* Step 2 (run): ./psieve | |
*/ | |
#include <stdio.h> | |
#include <math.h> |