1 | <?php |
||
11 | class SequenceProvider |
||
12 | { |
||
13 | |||
14 | const EULER_ZIGZAG = [ |
||
15 | '1', // 0 |
||
16 | '1', // 1 |
||
17 | '1', // 2 |
||
18 | '2', // 3 |
||
19 | '5', // 4 |
||
20 | '16', // 5 |
||
21 | '61', // 6 |
||
22 | '272', // 7 |
||
23 | '1385', // 8 |
||
24 | '7936', // 9 |
||
25 | '50521', // 10 |
||
26 | '353792', // 11 |
||
27 | '2702765', // 12 |
||
28 | '22368256', // 13 |
||
29 | '199360981', // 14 |
||
30 | '1903757312', // 15 |
||
31 | '19391512145', // 16 |
||
32 | '209865342976', // 17 |
||
33 | '2404879675441', // 18 |
||
34 | '29088885112832', // 19 |
||
35 | '370371188237525', // 20 |
||
36 | '4951498053124096', // 21 |
||
37 | '69348874393137901', // 22 |
||
38 | '1015423886506852352', // 23 |
||
39 | '15514534163557086905', // 24 |
||
40 | '246921480190207983616', // 25 |
||
41 | '4087072509293123892361', // 26 |
||
42 | '70251601603943959887872', // 27 |
||
43 | '1252259641403629865468285', // 28 |
||
44 | '23119184187809597841473536', // 29 |
||
45 | '441543893249023104553682821', // 30 |
||
46 | '8713962757125169296170811392', // 31 |
||
47 | '177519391579539289436664789665', // 32 |
||
48 | '3729407703720529571097509625856', // 33 |
||
49 | '80723299235887898062168247453281', // 34 |
||
50 | '1798651693450888780071750349094912', // 35 |
||
51 | '41222060339517702122347079671259045', // 36 |
||
52 | '970982810785059112379399707952152576', // 37 |
||
53 | '23489580527043108252017828576198947741', // 38 |
||
54 | '583203324917310043943191641625494290432', // 39 |
||
55 | '14851150718114980017877156781405826684425', // 40 |
||
56 | '387635983772083031828014624002175135645696', // 41 |
||
57 | '10364622733519612119397957304745185976310201', // 42 |
||
58 | '283727921907431909304183316295787837183229952', // 43 |
||
59 | '7947579422597592703608040510088070619519273805', // 44 |
||
60 | '227681379129930886488600284336316164603920777216', // 45 |
||
61 | '6667537516685544977435028474773748197524107684661', // 46 |
||
62 | '199500252157859031027160499643195658166340757225472', // 47 |
||
63 | '6096278645568542158691685742876843153976539044435185', // 48 |
||
64 | '190169564657928428175235445073924928592047775873499136', // 49 |
||
65 | '6053285248188621896314383785111649088103498225146815121', // 50 |
||
66 | ]; |
||
67 | |||
68 | /** |
||
69 | * OEIS: A005408 |
||
70 | * |
||
71 | * @param $n |
||
72 | * |
||
73 | * @return DecimalInterface|NumberInterface |
||
74 | */ |
||
75 | 7 | public static function nthOddNumber($n) |
|
83 | |||
84 | /** |
||
85 | * OEIS: A005843 |
||
86 | * |
||
87 | * @param $n |
||
88 | * |
||
89 | * @return DecimalInterface|NumberInterface |
||
90 | */ |
||
91 | 2 | public static function nthEvenNumber($n) |
|
99 | |||
100 | /** |
||
101 | * OEIS: A033999 |
||
102 | * |
||
103 | * @param $n |
||
104 | * |
||
105 | * @return DecimalInterface|NumberInterface |
||
106 | */ |
||
107 | 3 | public static function nthPowerNegativeOne($n) |
|
115 | |||
116 | /** |
||
117 | * OEIS: A000111 |
||
118 | * |
||
119 | * @param $n |
||
120 | * |
||
121 | * @return DecimalInterface|NumberInterface |
||
122 | * @throws IntegrityConstraint |
||
123 | */ |
||
124 | 2 | public static function nthEulerZigzag($n) |
|
140 | |||
141 | /** |
||
142 | * WARNING: This function is VERY unoptimized. Be careful of large m values. |
||
143 | * |
||
144 | * @param $n |
||
145 | * |
||
146 | * @return DecimalInterface|NumberInterface |
||
147 | */ |
||
148 | public static function nthBernoulliNumber($n) |
||
174 | |||
175 | /** |
||
176 | * OEIS: A000045 |
||
177 | * |
||
178 | * This uses an implementation of the fast-doubling Karatsuba multiplication algorithm as described by 'Nayuki': |
||
179 | * |
||
180 | * https://www.nayuki.io/page/fast-fibonacci-algorithms |
||
181 | * |
||
182 | * @param $n |
||
183 | * @return ImmutableNumber |
||
184 | * @throws IntegrityConstraint |
||
185 | */ |
||
186 | public static function nthFibonacciNumber($n): ImmutableNumber |
||
209 | |||
210 | private static function _fib(ImmutableNumber $number): array |
||
231 | |||
232 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: