Advanced (optimised) method for checking if provided number is prime.
For example for number 104743 it should return true, for 104744 - false.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
number |
Number
|
Number that we check on prime. |
Returns:
- Type:
-
Boolean
Will return true if provided number is prime.
Example
var isPrime = require('path-to-algorithms/src/is-prime').isPrime;
console.log(isPrime(7)); // true
console.log(isPrime(18)); // false