BlueBook
p183ex7 - Sieve
Given an integer N, perform the Sieve of Eratosthenes on the integers from 1 to N inclusive.
Input
A single integer N (1 ≤ N ≤ 500).Output
N lines each containing a single integer. The integer on the ith line should be a one if i is prime, or a zero if it is not a prime.Sample Input
9
Sample Output
0 1 1 0 1 0 1 0 0
All Submissions
Best Solutions
Point Value: 4
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 30, 2008
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)