### 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

*i*

^{th}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)

whcpeterwangon Feb 19, 2018 - 2:39:14 am UTC what am I doing wrong?hansonw1on Nov 02, 2008 - 11:35:14 pm UTC Fixed