Number is Prime
Problem Description​
Write a function that accepts an integer as its parameter and returns true
if the number is prime.
Tip: A number is considered prime if it is greater than one and has no positive divisors other than 1 and itself.
Input​
- A single integer.
Output​
- A boolean value:
true
if the number is prime,false
otherwise.
Constraints​
- The input number can be any integer.
Example​
Input:
11Output:
trueExplanation:
The number 11 is prime because it has no divisors other than 1 and itself.
Input:
13Output:
trueExplanation:
The number 13 is prime because it has no divisors other than 1 and itself.
Input:
4Output:
falseExplanation:
The number 4 is not prime because it is divisible by 2.
Input:
9Output:
falseExplanation:
The number 9 is not prime because it is divisible by 3.
Input:
16777259Output:
trueExplanation:
The number 16777259 is prime because it has no divisors other than 1 and itself.