BlueBook - Sieve

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 16M

Problem types
BlueBook

Given an integer N, perform the Sieve of Eratosthenes on the integers from 1 to N inclusive.

Input Specification

A single integer N (1 \le N \le 500).

Output Specification

N lines each containing a single integer. The integer on the i^\text{th} line should be 1 if i is prime, or 0 if it is not a prime.

Sample Input

9

Sample Output

0
1
1
0
1
0
1
0
0

Comments


  • 0
    mariuspuzhouli  commented on June 12, 2022, 1:03 a.m. edited

    it is simple cause 'A single integer N (1 \le N \le 500).'