Write a program that tests if a number n
is prime by checking that none of the integers between 2
and n-1
(inclusive) divide n
(you must use this algorithm!). The input to STDIN should be an integer n
(strictly) greater than 1. The output to STDOUT should be prime
if n
is prime and not prime
if n
is not prime.
Even though you are intentionally writing an inefficient program, this is still code golf, fellas. Standard CG rules apply. Shortest code in bytes wins.
O(n)
inefficient enough? Or do you just mean by following your specific algorithm? \$\endgroup\$2
ton-1
. \$\endgroup\$