File tree Expand file tree Collapse file tree 2 files changed +151
-77
lines changed
lib/node_modules/@stdlib/math/base/special/lucas Expand file tree Collapse file tree 2 files changed +151
-77
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2024 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict' ;
20
+
21
+ // MODULES //
22
+
23
+ var addon = require ( './../src/addon.node' ) ;
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Computes the nth Lucas number.
30
+ *
31
+ * @private
32
+ * @param {NonNegativeInteger } n - the Lucas number to compute
33
+ * @returns {NonNegativeInteger } Lucas number
34
+ *
35
+ * @example
36
+ * var y = lucas( 0 );
37
+ * // returns 2
38
+ *
39
+ * @example
40
+ * var y = lucas( 1 );
41
+ * // returns 1
42
+ *
43
+ * @example
44
+ * var y = lucas( 2 );
45
+ * // returns 3
46
+ *
47
+ * @example
48
+ * var y = lucas( 3 );
49
+ * // returns 4
50
+ *
51
+ * @example
52
+ * var y = lucas( 4 );
53
+ * // returns 7
54
+ *
55
+ * @example
56
+ * var y = lucas( 5 );
57
+ * // returns 11
58
+ *
59
+ * @example
60
+ * var y = lucas( 6 );
61
+ * // returns 18
62
+ *
63
+ * @example
64
+ * var y = lucas( -1.0 );
65
+ * // returns NaN
66
+ */
67
+ function lucas ( n ) {
68
+ return addon ( n ) ;
69
+ }
70
+
71
+
72
+ // EXPORTS //
73
+
74
+ module . exports = lucas ;
Original file line number Diff line number Diff line change 20
20
#include "stdlib/constants/float64/max_safe_nth_lucas.h"
21
21
22
22
static const int64_t lucas_value [ 77 ] = {
23
- 2 ,
24
- 1 ,
25
- 3 ,
26
- 4 ,
27
- 7 ,
28
- 11 ,
29
- 18 ,
30
- 29 ,
31
- 47 ,
32
- 76 ,
33
- 123 ,
34
- 199 ,
35
- 322 ,
36
- 521 ,
37
- 843 ,
38
- 1364 ,
39
- 2207 ,
40
- 3571 ,
41
- 5778 ,
42
- 9349 ,
43
- 15127 ,
44
- 24476 ,
45
- 39603 ,
46
- 64079 ,
47
- 103682 ,
48
- 167761 ,
49
- 271443 ,
50
- 439204 ,
51
- 710647 ,
52
- 1149851 ,
53
- 1860498 ,
54
- 3010349 ,
55
- 4870847 ,
56
- 7881196 ,
57
- 12752043 ,
58
- 20633239 ,
59
- 33385282 ,
60
- 54018521 ,
61
- 87403803 ,
62
- 141422324 ,
63
- 228826127 ,
64
- 370248451 ,
65
- 599074578 ,
66
- 969323029 ,
67
- 1568397607 ,
68
- 2537720636 ,
69
- 4106118243 ,
70
- 6643838879 ,
71
- 10749957122 ,
72
- 17393796001 ,
73
- 28143753123 ,
74
- 45537549124 ,
75
- 73681302247 ,
76
- 119218851371 ,
77
- 192900153618 ,
78
- 312119004989 ,
79
- 505019158607 ,
80
- 817138163596 ,
81
- 1322157322203 ,
82
- 2139295485799 ,
83
- 3461452808002 ,
84
- 5600748293801 ,
85
- 9062201101803 ,
86
- 14662949395604 ,
87
- 23725150497407 ,
88
- 38388099893011 ,
89
- 62113250390418 ,
90
- 100501350283429 ,
91
- 162614600673847 ,
92
- 263115950957276 ,
93
- 425730551631123 ,
94
- 688846502588399 ,
95
- 1114577054219522 ,
96
- 1803423556807921 ,
97
- 2918000611027443 ,
98
- 4721424167835364 ,
99
- 7639424778862807
23
+ 2 ,
24
+ 1 ,
25
+ 3 ,
26
+ 4 ,
27
+ 7 ,
28
+ 11 ,
29
+ 18 ,
30
+ 29 ,
31
+ 47 ,
32
+ 76 ,
33
+ 123 ,
34
+ 199 ,
35
+ 322 ,
36
+ 521 ,
37
+ 843 ,
38
+ 1364 ,
39
+ 2207 ,
40
+ 3571 ,
41
+ 5778 ,
42
+ 9349 ,
43
+ 15127 ,
44
+ 24476 ,
45
+ 39603 ,
46
+ 64079 ,
47
+ 103682 ,
48
+ 167761 ,
49
+ 271443 ,
50
+ 439204 ,
51
+ 710647 ,
52
+ 1149851 ,
53
+ 1860498 ,
54
+ 3010349 ,
55
+ 4870847 ,
56
+ 7881196 ,
57
+ 12752043 ,
58
+ 20633239 ,
59
+ 33385282 ,
60
+ 54018521 ,
61
+ 87403803 ,
62
+ 141422324 ,
63
+ 228826127 ,
64
+ 370248451 ,
65
+ 599074578 ,
66
+ 969323029 ,
67
+ 1568397607 ,
68
+ 2537720636 ,
69
+ 4106118243 ,
70
+ 6643838879 ,
71
+ 10749957122 ,
72
+ 17393796001 ,
73
+ 28143753123 ,
74
+ 45537549124 ,
75
+ 73681302247 ,
76
+ 119218851371 ,
77
+ 192900153618 ,
78
+ 312119004989 ,
79
+ 505019158607 ,
80
+ 817138163596 ,
81
+ 1322157322203 ,
82
+ 2139295485799 ,
83
+ 3461452808002 ,
84
+ 5600748293801 ,
85
+ 9062201101803 ,
86
+ 14662949395604 ,
87
+ 23725150497407 ,
88
+ 38388099893011 ,
89
+ 62113250390418 ,
90
+ 100501350283429 ,
91
+ 162614600673847 ,
92
+ 263115950957276 ,
93
+ 425730551631123 ,
94
+ 688846502588399 ,
95
+ 1114577054219522 ,
96
+ 1803423556807921 ,
97
+ 2918000611027443 ,
98
+ 4721424167835364 ,
99
+ 7639424778862807
100
100
};
101
101
102
102
/**
You can’t perform that action at this time.
0 commit comments