Generate Primes

5

1 votes
Problem

Given a number 'N' generate all the primes smaller than or equal to 'N'.

Try it using Sieve of Eratosthenes.

 

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

Input: 30

Output: 2 3 5 7 11 13 17 19 23 29 

Editor Image

?