Is This a Prime Number?


Define a function called is_prime? that takes one integer argument and returns true or false depending on if the integer is a prime.

Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.


=> true

Assumptions You can assume you will be given an integer input. You can not assume that the integer will be only positive. You may be given negative numbers as well (or 0).

def is_prime? n end
< >