README.md (1490B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2020 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isPrime 22 23 > Test if a number is a prime. 24 25 <section class="intro"> 26 27 A **prime number** is defined as an integer value greater than `1` which is only divisible by `1` and itself. 28 29 </section> 30 31 <!-- /.intro --> 32 33 <section class="usage"> 34 35 ## Usage 36 37 ```javascript 38 var isPrime = require( '@stdlib/math/base/assert/is-prime' ); 39 ``` 40 41 #### isPrime( x ) 42 43 Tests if a number is a prime. 44 45 ```javascript 46 var bool = isPrime( 7.0 ); 47 // returns true 48 ``` 49 50 </section> 51 52 <!-- /.usage --> 53 54 <section class="notes"> 55 56 </section> 57 58 <!-- /.notes --> 59 60 <section class="examples"> 61 62 ## Examples 63 64 <!-- eslint no-undef: "error" --> 65 66 ```javascript 67 var isPrime = require( '@stdlib/math/base/assert/is-prime' ); 68 69 var bool = isPrime( 11.0 ); 70 // returns true 71 72 bool = isPrime( 3.14 ); 73 // returns false 74 75 bool = isPrime( NaN ); 76 // returns false 77 ``` 78 79 </section> 80 81 <!-- /.examples --> 82 83 <section class="links"> 84 85 </section> 86 87 <!-- /.links -->