Ad

As far as I can tell, you don't want a simple number but a prime number.
I added 5075 as it's also not a prime number.

https://en.wikipedia.org/wiki/List_of_prime_numbers

Code
Diff
  • export const checkIsPrimeNumber = (n: number) => 
    {
      if (!Number.isInteger(n)) return false;
      for (var i = 2; i < n; i++) {
        if (n % i === 0) return false;
      }
      return n > 1;
    };
    • export const checkIsNumberSimple = (number: number) => {
    • // Check if the number is integer
    • if (number % 1 != 0) return false;
    • if (number < 2) return false;
    • if (number != 2 && number % 2 == 0) return false;
    • if (number != 3 && number % 3 == 0) return false;
    • return true;
    • export const checkIsPrimeNumber = (n: number) =>
    • {
    • if (!Number.isInteger(n)) return false;
    • for (var i = 2; i < n; i++) {
    • if (n % i === 0) return false;
    • }
    • return n > 1;
    • };