Skip to content
Onsite

Check for Prime

EasyP2Coding

Given an integer n, return true if it is a prime number and false otherwise.

A prime is an integer greater than 1 whose only positive divisors are 1 and itself.

Example 1

Input
n = 7
Output
true

Example 2

Input
n = 1
Output
false

Example 3

Input
n = 2
Output
true

Constraints

  • 0 <= n <= 10^9

Hints

Run checks the 3 visible tests, Submit all 10.