Sieve of Eratosthenes P89124


Statement
 

pdf   zip

thehtml

Given several natural numbers, tell which are prime and which are not.

Input

Input consists of (possibly, many) natural numbers n ≤ 106.

Output

For each n, tell if it is prime or not.

Observation

Use the Sieve of Eratosthenes.

Public test cases
  • Input

    9
    23
    1
    10000
    

    Output

    9 is not prime
    23 is prime
    1 is not prime
    10000 is not prime
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Python