Skip to content

Commit 37f2cc8

Browse files
author
aayush0325
committed
feat: basic setup done
1 parent ac06419 commit 37f2cc8

File tree

5 files changed

+634
-0
lines changed

5 files changed

+634
-0
lines changed
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 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] in single-precision floating-point format.
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:nonfibonaccif_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+
```math
34+
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
35+
```
36+
37+
<!-- <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:nonfibonaccif_number">
38+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@bb29798906e119fcb2af99e94b60407a270c9b32/lib/node_modules/@stdlib/math/base/special/nonfibonaccif/docs/img/equation_nonfibonaccif_number.svg" alt="Formula to compute the nth non-Fibonacci number.">
39+
<br>
40+
</div> -->
41+
42+
<!-- </equation> -->
43+
44+
where `φ` is the [golden ratio][golden-ratio].
45+
46+
</section>
47+
48+
<!-- /.intro -->
49+
50+
<!-- Package usage documentation. -->
51+
52+
<section class="usage">
53+
54+
## Usage
55+
56+
```javascript
57+
var nonfibonaccif = require( '@stdlib/math/base/special/nonfibonaccif' );
58+
```
59+
60+
#### nonfibonaccif( n )
61+
62+
Computes the nth [non-Fibonacci number][fibonacci-number] in single-precision floating-point format.
63+
64+
```javascript
65+
var v = nonfibonaccif( 1 );
66+
// returns 4
67+
68+
v = nonfibonaccif( 2 );
69+
// returns 6
70+
71+
v = nonfibonaccif( 3 );
72+
// returns 7
73+
```
74+
75+
If provided either a non-integer or `n < 1`, the function returns `NaN`.
76+
77+
```javascript
78+
var v = nonfibonaccif( -1 );
79+
// returns NaN
80+
81+
v = nonfibonaccif( 3.14 );
82+
// returns NaN
83+
```
84+
85+
If provided `NaN`, the function returns `NaN`.
86+
87+
```javascript
88+
var v = nonfibonaccif( NaN );
89+
// returns NaN
90+
```
91+
92+
</section>
93+
94+
<!-- /.usage -->
95+
96+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
97+
98+
<section class="notes">
99+
100+
</section>
101+
102+
<!-- /.notes -->
103+
104+
<section class="examples">
105+
106+
## Examples
107+
108+
<!-- eslint no-undef: "error" -->
109+
110+
```javascript
111+
var nonfibonaccif = require( '@stdlib/math/base/special/nonfibonaccif' );
112+
113+
var v;
114+
var i;
115+
116+
for ( i = 1; i < 100; i++ ) {
117+
v = nonfibonaccif( i );
118+
console.log( 'nonfibonaccif(%d) = %d', i, v );
119+
}
120+
```
121+
122+
</section>
123+
124+
<!-- /.examples -->
125+
126+
<!-- C interface documentation. -->
127+
128+
* * *
129+
130+
<section class="c">
131+
132+
## C APIs
133+
134+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
135+
136+
<section class="intro">
137+
138+
</section>
139+
140+
<!-- /.intro -->
141+
142+
<!-- C usage documentation. -->
143+
144+
<section class="usage">
145+
146+
### Usage
147+
148+
```c
149+
#include "stdlib/math/base/special/nonfibonaccif.h"
150+
```
151+
152+
#### stdlib_base_nonfibonaccif( x )
153+
154+
Computes the nth non-Fibonacci number in single-precision floating-point format.
155+
156+
```c
157+
float out = stdlib_base_nonfibonaccif( 1 );
158+
// returns 4.0f
159+
160+
out = stdlib_base_nonfibonaccif( 2 );
161+
// returns 6.0f
162+
```
163+
164+
The function accepts the following arguments:
165+
166+
- **x**: `[in] int32_t` input value.
167+
168+
```c
169+
float stdlib_base_nonfibonaccif( const int32_t x );
170+
```
171+
172+
</section>
173+
174+
<!-- /.usage -->
175+
176+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
177+
178+
<section class="notes">
179+
180+
</section>
181+
182+
<!-- /.notes -->
183+
184+
<!-- C API usage examples. -->
185+
186+
<section class="examples">
187+
188+
### Examples
189+
190+
```c
191+
#include "stdlib/math/base/special/nonfibonaccif.h"
192+
#include <stdio.h>
193+
#include <stdlib.h>
194+
int main( void ) {
195+
int i;
196+
for ( i = 1; i < 12; i++ ) {
197+
float result = stdlib_base_nonfibonaccif( i );
198+
printf( "x: %i => result: %lf", i , result );
199+
}
200+
}
201+
```
202+
203+
</section>
204+
205+
<!-- /.examples -->
206+
207+
</section>
208+
209+
<!-- /.c -->
210+
211+
<!-- 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. -->
212+
213+
* * *
214+
215+
<section class="references">
216+
217+
## References
218+
219+
- Gould, H.W. 1965. "Non-Fibonacci Numbers." _Fibonacci Quarterly_, no. 3: 177–83. [&lt;http://www.fq.math.ca/Scanned/3-3/gould.pdf>][@gould:1965a].
220+
- Farhi, Bakir. 2011. "An explicit formula generating the non-Fibonacci numbers." _arXiv_ abs/1105.1127 \[Math.NT] (May): 1–5. [&lt;https://arxiv.org/abs/1105.1127>][@farhi:2011a].
221+
222+
</section>
223+
224+
<!-- /.references -->
225+
226+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
227+
228+
<section class="related">
229+
230+
</section>
231+
232+
<!-- /.related -->
233+
234+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
235+
236+
<section class="links">
237+
238+
[fibonacci-number]: https://en.wikipedia.org/wiki/Fibonacci_number
239+
240+
[golden-ratio]: https://en.wikipedia.org/wiki/Golden_ratio
241+
242+
[@gould:1965a]: http://www.fq.math.ca/Scanned/3-3/gould.pdf
243+
244+
[@farhi:2011a]: https://arxiv.org/abs/1105.1127
245+
246+
<!-- <related-links> -->
247+
248+
<!-- </related-links> -->
249+
250+
</section>
251+
252+
<!-- /.links -->

0 commit comments

Comments
 (0)