4 added 24 characters in body

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than or equal to i, which is greater than or equal to 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except 2, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3
5


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except 2, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3
5


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than or equal to i, which is greater than or equal to 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except 2, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3
5


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

3 edited body

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except two2, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3
5


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except two, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except 2, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3
5


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

2 added 8 characters in body

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except two, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except two, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23


Inputs are denoted by >.

# The Challenge

Implement the Sundaram sieve for finding prime numbers below n. Take an input integer, n, and output the prime numbers below n. You can assume that n will always be less than or equal to one million.

# Sieve

1. Start with a list of the integers from 1 to n.

2. Remove all numbers that are in the form i + j + 2ij where:

• i and j are less than n. j is always greater than i, which is greater than 1.

• i + j + 2ij is less than or equal to n

3. Multiply the remaining numbers by 2, and add 1.

This will yield all the prime numbers (except two, which should be included in your output) less than 2n + 2.

Here is an animation of the sieve being used to find primes below 202.

# Output

Your output should be every prime integer ≤ n (in ascending order) followed by a newline:

2
3


Where n is 5.

# Examples

> 10
2
3
5
7

> 30
2
3
5
7
11
13
17
19
23
29


Inputs are denoted by >.

1