README.md (1753B)
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 # isCoprime 22 23 > Test if two numbers are [coprime][coprime-integers]. 24 25 <section class="intro"> 26 27 Two integers `a` and `b` are said to be **coprime** (or **relatively prime** or **mutually prime**) if the only positive integer that divides both of them is `1`. 28 29 </section> 30 31 <!-- /.intro --> 32 33 <section class="usage"> 34 35 ## Usage 36 37 ```javascript 38 var isCoprime = require( '@stdlib/math/base/assert/is-coprime' ); 39 ``` 40 41 #### isCoprime( a, b ) 42 43 Tests if two numbers are [coprime][coprime-integers]. 44 45 ```javascript 46 var bool = isCoprime( 14.0, 15.0 ); 47 // returns true 48 49 bool = isCoprime( 14.0, 21.0 ); 50 // returns false 51 ``` 52 53 </section> 54 55 <!-- /.usage --> 56 57 <section class="notes"> 58 59 </section> 60 61 <!-- /.notes --> 62 63 <section class="examples"> 64 65 ## Examples 66 67 <!-- eslint no-undef: "error" --> 68 69 ```javascript 70 var isCoprime = require( '@stdlib/math/base/assert/is-coprime' ); 71 72 var bool = isCoprime( 5.0, 7.0 ); 73 // returns true 74 75 bool = isCoprime( 5.0, 15.0 ); 76 // returns false 77 78 bool = isCoprime( NaN, NaN ); 79 // returns false 80 ``` 81 82 </section> 83 84 <!-- /.examples --> 85 86 <section class="links"> 87 88 [coprime-integers]: https://en.wikipedia.org/wiki/Coprime_integers 89 90 </section> 91 92 <!-- /.links -->