/prime-numbers

Finds prime numbers up to a given number using the Sieve of Eratosthenes algorithm

Primary LanguageC++MIT LicenseMIT

prime-numbers

Finds prime numbers up to a given number using the Sieve of Eratosthenes algorithm.

  • Lists every prime number
  • Try piping it to a file :)

Syntax

primesto.exe [positive natural number up to 10000000 (10 million)]

Some examples

Using command line argument

$ ./primes.exe 100
1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

Without command line argument

$ ./primes.exe
Enter a positive number: 42
1 2 3 5 7 11 13 17 19 23 29 31 37 41