Example challenge

You are given a sequence of positive integer numbers as input, one in each line. Write a program which will decide which of these numbers are prime. For each of the numbers at input, you should write a line containing 1 if it is prime and 0 if it is composite.

Note: The solution will be tested on two datasets. The first dataset consists of small numbers and tests the correctness of the solution. The second dataset consists of larger numbers and acceptance depends on the memory efficiency of the solution.


Sample input:

1
2
17

Sample output:

0
1
1

Sample solutions


function foo(items) { var x = "All this is syntax highlighted"; return x; }