Determine whether a given number is a prime number.

Hint

To determine if a given number is prime, first, check if the number is less than or equal to 1. If it is, then it is not prime, so return false. Next, if the number is less than or equal to 3, it is prime, so return true. Otherwise, iterate through numbers starting from 2 up to one less than the given number. During each iteration, check if the given number is divisible by the current iteration number. If it is divisible, then the number is not prime, and you should return false. If the loop completes without finding any divisors, then the number is prime, and you should return true.

# Python implementation
def isPrime(n):
  if n <= 1:
    return False
  
  if n <= 3:
    return True
  
  i = 2
  while i < n:
    if n % i == 0:
      return False
    i += 1

  return True

print (isPrime(4))
// Javascript implementation
function isPrime(n) {
  if (n <= 1) {
    return false;
  }

  if (n <= 3) {
    return true;
  }

  for (let i = 2; i < n; i++) {
    if(n % i == 0) {
      return false;
    }
  }

  return true;
}

console.log(isPrime(4));