const isPrime = (num: number) => {
        const boundary: number = Math.floor(Math.sqrt(num));
        for (let i = 2; i <= boundary; i++) if (num % i === 0) return false;
        return num >= 2;
      };
      
      Typescript language logo

      Prime number

      Codiga's TypeScript Recipes

      Checks if the provided integer is a prime number.

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.