README.md (4109B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 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 # Non-Fibonacci 22 23 > Compute the nth [non-Fibonacci number][fibonacci-number]. 24 25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 26 27 <section class="intro"> 28 29 The nth [non-Fibonacci number][fibonacci-number] is given by 30 31 <!-- <equation class="equation" label="eq:nonfibonacci_number" align="center" raw="f(n) = \left \lfloor{ n + 1 + \log_\varphi \biggl( \sqrt{5}( n + 1 + \log_\varphi(\sqrt{5}(n+1))) - 5 + \tfrac{3}{n+1} \biggr) - 2 } \right \rfloor" alt="Formula to compute the nth non-Fibonacci number."> --> 32 33 <div class="equation" align="center" data-raw-text="f(n) = \left \lfloor{ n + 1 + \log_\varphi \biggl( \sqrt{5}( n + 1 + \log_\varphi(\sqrt{5}(n+1))) - 5 + \tfrac{3}{n+1} \biggr) - 2 } \right \rfloor" data-equation="eq:nonfibonacci_number"> 34 <img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/nonfibonacci/docs/img/equation_nonfibonacci_number.svg" alt="Formula to compute the nth non-Fibonacci number."> 35 <br> 36 </div> 37 38 <!-- </equation> --> 39 40 where `φ` is the [golden ratio][golden-ratio]. 41 42 </section> 43 44 <!-- /.intro --> 45 46 <!-- Package usage documentation. --> 47 48 <section class="usage"> 49 50 ## Usage 51 52 ```javascript 53 var nonfibonacci = require( '@stdlib/math/base/special/nonfibonacci' ); 54 ``` 55 56 #### nonfibonacci( n ) 57 58 Computes the nth [non-Fibonacci number][fibonacci-number]. 59 60 ```javascript 61 var v = nonfibonacci( 1 ); 62 // returns 4 63 64 v = nonfibonacci( 2 ); 65 // returns 6 66 67 v = nonfibonacci( 3 ); 68 // returns 7 69 ``` 70 71 If provided either a non-integer or `n < 1`, the function returns `NaN`. 72 73 ```javascript 74 var v = nonfibonacci( -1 ); 75 // returns NaN 76 77 v = nonfibonacci( 3.14 ); 78 // returns NaN 79 ``` 80 81 If provided `NaN`, the function returns `NaN`. 82 83 ```javascript 84 var v = nonfibonacci( NaN ); 85 // returns NaN 86 ``` 87 88 </section> 89 90 <!-- /.usage --> 91 92 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 93 94 <section class="notes"> 95 96 </section> 97 98 <!-- /.notes --> 99 100 <section class="examples"> 101 102 ## Examples 103 104 <!-- eslint no-undef: "error" --> 105 106 ```javascript 107 var nonfibonacci = require( '@stdlib/math/base/special/nonfibonacci' ); 108 109 var v; 110 var i; 111 112 for ( i = 1; i < 100; i++ ) { 113 v = nonfibonacci( i ); 114 console.log( 'nonfibonacci(%d) = %d', i, v ); 115 } 116 ``` 117 118 </section> 119 120 <!-- /.examples --> 121 122 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 123 124 * * * 125 126 <section class="references"> 127 128 ## References 129 130 - Gould, H.W. 1965. "Non-Fibonacci Numbers." _Fibonacci Quarterly_, no. 3: 177–83. [<http://www.fq.math.ca/Scanned/3-3/gould.pdf>][@gould:1965a]. 131 - Farhi, Bakir. 2011. "An explicit formula generating the non-Fibonacci numbers." _arXiv_ abs/1105.1127 \[Math.NT] (May): 1–5. [<https://arxiv.org/abs/1105.1127>][@farhi:2011a]. 132 133 </section> 134 135 <!-- /.references --> 136 137 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 138 139 <section class="links"> 140 141 [fibonacci-number]: https://en.wikipedia.org/wiki/Fibonacci_number 142 143 [golden-ratio]: https://en.wikipedia.org/wiki/Golden_ratio 144 145 [@gould:1965a]: http://www.fq.math.ca/Scanned/3-3/gould.pdf 146 147 [@farhi:2011a]: https://arxiv.org/abs/1105.1127 148 149 </section> 150 151 <!-- /.links -->