DWITE Online Computer Programming Contest
October 2007

Problem 1

Vanilla Primes

In mathematics, a prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example: 2, 3, 5, 7, 11, 13, 17, 19 are the first eight prime numbers. A vanilla flavour programming problem is to figure out if a given number is a prime or not.

Input

A single integer N (-1000 ≤ N ≤ 1000)

Output

A single line containing either the word "prime" or the word "not", depending on whether N is prime or not.

Sample Input

-1

Sample Output

not

Sample Input

1

Sample Output

not

Sample Input

2

Sample Output

prime

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Mar 19, 2010

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

What is wrong with my code?

in your code, remove the a!=2 in your for statement. It's unnecessary since the loop wouldn't run anyway if it was 2. You should print prime after the for loop, because the number wouldn't have factors for all the elements in your for loop, and still not be prime.

For example, if the number was 16, and I run it through your loop, it would output "prime' because 16 is not divisible by 7. Please run through your own test cases before posting a question.

bruh, he already solved the problem