mapFolding 0.15.4__py3-none-any.whl → 0.16.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mapFolding/__init__.py +7 -9
- mapFolding/_theSSOT.py +1 -0
- mapFolding/algorithms/daoOfMapFolding.py +1 -2
- mapFolding/algorithms/getBucketsTotal.py +137 -0
- mapFolding/algorithms/matrixMeanders.py +457 -286
- mapFolding/algorithms/oeisIDbyFormula.py +310 -76
- mapFolding/algorithms/zCuzDocStoopidoeisIDbyFormula.py +84 -0
- mapFolding/basecamp.py +99 -14
- mapFolding/dataBaskets.py +74 -0
- mapFolding/oeis.py +3 -2
- mapFolding/reference/A000682facts.py +662 -0
- mapFolding/reference/A005316facts.py +62 -0
- mapFolding/reference/matrixMeandersAnalysis/__init__.py +1 -0
- mapFolding/reference/matrixMeandersAnalysis/evenEven.py +144 -0
- mapFolding/reference/matrixMeandersAnalysis/oddEven.py +54 -0
- mapFolding/someAssemblyRequired/A007822/A007822rawMaterials.py +55 -0
- mapFolding/someAssemblyRequired/A007822/__init__.py +0 -0
- mapFolding/someAssemblyRequired/A007822/makeA007822AsynchronousModules.py +185 -0
- mapFolding/someAssemblyRequired/A007822/makeA007822Modules.py +71 -0
- mapFolding/someAssemblyRequired/RecipeJob.py +2 -2
- mapFolding/someAssemblyRequired/__init__.py +9 -2
- mapFolding/someAssemblyRequired/_toolIfThis.py +4 -3
- mapFolding/someAssemblyRequired/_toolkitContainers.py +8 -8
- mapFolding/someAssemblyRequired/infoBooth.py +27 -30
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +1 -1
- mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +5 -2
- mapFolding/someAssemblyRequired/makingModules_count.py +301 -0
- mapFolding/someAssemblyRequired/makingModules_doTheNeedful.py +120 -0
- mapFolding/someAssemblyRequired/mapFolding/__init__.py +0 -0
- mapFolding/someAssemblyRequired/mapFolding/makeMapFoldingModules.py +220 -0
- mapFolding/someAssemblyRequired/toolkitMakeModules.py +152 -0
- mapFolding/someAssemblyRequired/toolkitNumba.py +1 -1
- mapFolding/someAssemblyRequired/transformationTools.py +1 -0
- mapFolding/syntheticModules/A007822/__init__.py +1 -0
- mapFolding/syntheticModules/{algorithmA007822Numba.py → A007822/algorithmNumba.py} +2 -4
- mapFolding/syntheticModules/A007822/asynchronous.py +148 -0
- mapFolding/syntheticModules/A007822/asynchronousAnnex.py +68 -0
- mapFolding/syntheticModules/A007822/asynchronousTheorem2.py +53 -0
- mapFolding/syntheticModules/A007822/asynchronousTrimmed.py +47 -0
- mapFolding/syntheticModules/dataPackingA007822.py +1 -1
- mapFolding/tests/test_computations.py +2 -2
- mapFolding/trim_memory.py +62 -0
- mapFolding/zCuzDocStoopid/__init__.py +1 -0
- mapFolding/zCuzDocStoopid/makeDocstrings.py +63 -0
- {mapfolding-0.15.4.dist-info → mapfolding-0.16.0.dist-info}/METADATA +9 -2
- mapfolding-0.16.0.dist-info/RECORD +100 -0
- mapFolding/someAssemblyRequired/A007822rawMaterials.py +0 -46
- mapFolding/someAssemblyRequired/makeAllModules.py +0 -764
- mapfolding-0.15.4.dist-info/RECORD +0 -78
- /mapFolding/syntheticModules/{algorithmA007822.py → A007822/algorithm.py} +0 -0
- /mapFolding/syntheticModules/{initializeStateA007822.py → A007822/initializeState.py} +0 -0
- /mapFolding/syntheticModules/{theorem2A007822.py → A007822/theorem2.py} +0 -0
- /mapFolding/syntheticModules/{theorem2A007822Numba.py → A007822/theorem2Numba.py} +0 -0
- /mapFolding/syntheticModules/{theorem2A007822Trimmed.py → A007822/theorem2Trimmed.py} +0 -0
- {mapfolding-0.15.4.dist-info → mapfolding-0.16.0.dist-info}/WHEEL +0 -0
- {mapfolding-0.15.4.dist-info → mapfolding-0.16.0.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.15.4.dist-info → mapfolding-0.16.0.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.15.4.dist-info → mapfolding-0.16.0.dist-info}/top_level.txt +0 -0
|
@@ -1,113 +1,347 @@
|
|
|
1
|
+
"""Compute a(n) for an OEIS ID by computing other OEIS IDs.
|
|
2
|
+
|
|
3
|
+
TODO Implement A178961 for unknown values of A001010
|
|
4
|
+
TODO A223094 For n >= 3: a(n) = n! - Sum_{k=3..n-1} (a(k)*n!/k!) - A000682(n+1). - _Roger Ford_, Aug 24 2024
|
|
5
|
+
TODO A301620 a(n) = Sum_{k=3..floor((n+3)/2)} (A259689(n+1,k)*(k-2)). - _Roger Ford_, Dec 10 2018
|
|
6
|
+
"""
|
|
1
7
|
from functools import cache
|
|
2
|
-
from mapFolding import countFolds
|
|
3
|
-
from mapFolding.
|
|
8
|
+
from mapFolding import countFolds, dictionaryOEISMeanders
|
|
9
|
+
from mapFolding.basecamp import A000682, A005316
|
|
4
10
|
|
|
5
11
|
@cache
|
|
6
12
|
def A000136(n: int) -> int:
|
|
7
|
-
|
|
13
|
+
"""
|
|
14
|
+
Compute A000136(n) as a function of A000682.
|
|
15
|
+
|
|
16
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A000136 is: "Number of ways of folding a strip of n labeled stamps."
|
|
17
|
+
|
|
18
|
+
The domain of A000136 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
19
|
+
has not yet been computed is 46.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
n : int
|
|
24
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
a(n) : int
|
|
29
|
+
Number of ways of folding a strip of n labeled stamps.
|
|
30
|
+
|
|
31
|
+
Would You Like to Know More?
|
|
32
|
+
----------------------------
|
|
33
|
+
OEIS : webpage
|
|
34
|
+
https://oeis.org/A000136
|
|
35
|
+
"""
|
|
36
|
+
return n * A000682(n)
|
|
8
37
|
|
|
9
38
|
def A000560(n: int) -> int:
|
|
10
|
-
|
|
39
|
+
"""
|
|
40
|
+
Compute A000560(n) as a function of A000682.
|
|
11
41
|
|
|
12
|
-
|
|
13
|
-
curveLocationsMAXIMUM: int = 1 << (2 * n + 4)
|
|
42
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A000560 is: "Number of ways of folding a strip of n labeled stamps."
|
|
14
43
|
|
|
15
|
-
|
|
16
|
-
|
|
44
|
+
The domain of A000560 starts at 2, therefore for values of `n` < 2, a(n) is undefined. The smallest value of n for which a(n)
|
|
45
|
+
has not yet been computed is 45.
|
|
17
46
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
47
|
+
Parameters
|
|
48
|
+
----------
|
|
49
|
+
n : int
|
|
50
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
21
51
|
|
|
22
|
-
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
a(n) : int
|
|
55
|
+
Number of ways of folding a strip of n labeled stamps.
|
|
23
56
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
57
|
+
Would You Like to Know More?
|
|
58
|
+
----------------------------
|
|
59
|
+
OEIS : webpage
|
|
60
|
+
https://oeis.org/A000560
|
|
61
|
+
"""
|
|
62
|
+
return A000682(n + 1) // 2
|
|
27
63
|
|
|
28
64
|
def A001010(n: int) -> int:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
"""
|
|
66
|
+
Compute A001010(n) as a function of A000682 or A007822.
|
|
67
|
+
|
|
68
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A001010 is: "Number of symmetric foldings of a strip of n stamps."
|
|
69
|
+
|
|
70
|
+
The domain of A001010 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
71
|
+
has not yet been computed is 53.
|
|
72
|
+
|
|
73
|
+
Parameters
|
|
74
|
+
----------
|
|
75
|
+
n : int
|
|
76
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
a(n) : int
|
|
81
|
+
Number of symmetric foldings of a strip of n stamps.
|
|
82
|
+
|
|
83
|
+
Would You Like to Know More?
|
|
84
|
+
----------------------------
|
|
85
|
+
OEIS : webpage
|
|
86
|
+
https://oeis.org/A001010
|
|
87
|
+
"""
|
|
88
|
+
if n == 1:
|
|
89
|
+
foldsTotal = 1
|
|
90
|
+
elif n & 1:
|
|
91
|
+
foldsTotal = 2 * countFolds(oeisID='A007822', oeis_n=(n - 1) // 2 + 1, flow='theorem2Numba')
|
|
92
|
+
else:
|
|
93
|
+
foldsTotal = 2 * A000682(n // 2 + 1)
|
|
94
|
+
return foldsTotal
|
|
44
95
|
|
|
45
96
|
def A001011(n: int) -> int:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
else:
|
|
49
|
-
foldsTotal = (A001010(n) + A000136(n)) // 4
|
|
50
|
-
return foldsTotal
|
|
51
|
-
|
|
52
|
-
def A005316getCurveLocations(n: int) -> dict[int, int]:
|
|
53
|
-
if n & 0b1:
|
|
54
|
-
return {22: 1}
|
|
55
|
-
else:
|
|
56
|
-
return {15: 1}
|
|
97
|
+
"""
|
|
98
|
+
Compute A001011(n) as a function of A000136 and A001010.
|
|
57
99
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
100
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A001011 is: "Number of ways to fold a strip of n blank stamps."
|
|
101
|
+
|
|
102
|
+
The domain of A001011 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
103
|
+
has not yet been computed is 46.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
n : int
|
|
108
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
109
|
+
|
|
110
|
+
Returns
|
|
111
|
+
-------
|
|
112
|
+
a(n) : int
|
|
113
|
+
Number of ways to fold a strip of n blank stamps.
|
|
114
|
+
|
|
115
|
+
Would You Like to Know More?
|
|
116
|
+
----------------------------
|
|
117
|
+
OEIS : webpage
|
|
118
|
+
https://oeis.org/A001011
|
|
119
|
+
"""
|
|
120
|
+
if n == 0:
|
|
121
|
+
foldsTotal = 1
|
|
122
|
+
else:
|
|
123
|
+
foldsTotal = (A001010(n) + A000136(n)) // 4
|
|
124
|
+
return foldsTotal
|
|
61
125
|
|
|
62
126
|
@cache
|
|
63
127
|
def A005315(n: int) -> int:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
128
|
+
"""
|
|
129
|
+
Compute A005315(n) as a function of A005316.
|
|
130
|
+
|
|
131
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A005315 is: "Closed meandric numbers (or meanders): number of ways a loop can cross a road 2n times."
|
|
132
|
+
|
|
133
|
+
The domain of A005315 starts at 0, therefore for values of `n` < 0, a(n) is undefined. The smallest value of n for which a(n)
|
|
134
|
+
has not yet been computed is 29.
|
|
135
|
+
|
|
136
|
+
Parameters
|
|
137
|
+
----------
|
|
138
|
+
n : int
|
|
139
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
140
|
+
|
|
141
|
+
Returns
|
|
142
|
+
-------
|
|
143
|
+
a(n) : int
|
|
144
|
+
Closed meandric numbers (or meanders): number of ways a loop can cross a road 2n times.
|
|
145
|
+
|
|
146
|
+
Would You Like to Know More?
|
|
147
|
+
----------------------------
|
|
148
|
+
OEIS : webpage
|
|
149
|
+
https://oeis.org/A005315
|
|
150
|
+
"""
|
|
151
|
+
if n == 1:
|
|
152
|
+
foldsTotal = 1
|
|
153
|
+
else:
|
|
154
|
+
foldsTotal = A005316(2 * n - 1)
|
|
155
|
+
return foldsTotal
|
|
69
156
|
|
|
70
157
|
def A060206(n: int) -> int:
|
|
71
|
-
|
|
158
|
+
"""
|
|
159
|
+
Compute A060206(n) as a function of A000682.
|
|
160
|
+
|
|
161
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A060206 is: "Number of rotationally symmetric closed meanders of length 4n+2."
|
|
162
|
+
|
|
163
|
+
The domain of A060206 starts at 0, therefore for values of `n` < 0, a(n) is undefined. The smallest value of n for which a(n)
|
|
164
|
+
has not yet been computed is 21.
|
|
165
|
+
|
|
166
|
+
Parameters
|
|
167
|
+
----------
|
|
168
|
+
n : int
|
|
169
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
170
|
+
|
|
171
|
+
Returns
|
|
172
|
+
-------
|
|
173
|
+
a(n) : int
|
|
174
|
+
Number of rotationally symmetric closed meanders of length 4n+2.
|
|
175
|
+
|
|
176
|
+
Would You Like to Know More?
|
|
177
|
+
----------------------------
|
|
178
|
+
OEIS : webpage
|
|
179
|
+
https://oeis.org/A060206
|
|
180
|
+
"""
|
|
181
|
+
return A000682(2 * n + 1)
|
|
72
182
|
|
|
73
183
|
def A077460(n: int) -> int:
|
|
74
|
-
|
|
184
|
+
"""
|
|
185
|
+
Compute A077460(n) as a function of A005315, A005316, and A060206.
|
|
75
186
|
|
|
76
|
-
|
|
77
|
-
a[n_] := If[OddQ[n], (A005316[[n + 1]] + A005316[[2n]] + A000682[[n]])/4
|
|
78
|
-
a(2n+1) = (A005315(2n+1) + A005316(2n+1) + A060206(n)) / 4.
|
|
187
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A077460 is: "Number of nonisomorphic ways a loop can cross a road (running East-West) 2n times."
|
|
79
188
|
|
|
80
|
-
|
|
81
|
-
|
|
189
|
+
The domain of A077460 starts at 0, therefore for values of `n` < 0, a(n) is undefined. The smallest value of n for which a(n)
|
|
190
|
+
has not yet been computed is 21.
|
|
82
191
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
foldsTotal = (A005315(n) + A005316(n) + A060206((n - 1) // 2)) // 4
|
|
88
|
-
else:
|
|
89
|
-
foldsTotal = (A005315(n) + 2 * A005316(n)) // 4
|
|
192
|
+
Parameters
|
|
193
|
+
----------
|
|
194
|
+
n : int
|
|
195
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
90
196
|
|
|
91
|
-
|
|
197
|
+
Returns
|
|
198
|
+
-------
|
|
199
|
+
a(n) : int
|
|
200
|
+
Number of nonisomorphic ways a loop can cross a road (running East-West) 2n times.
|
|
201
|
+
|
|
202
|
+
Would You Like to Know More?
|
|
203
|
+
----------------------------
|
|
204
|
+
OEIS : webpage
|
|
205
|
+
https://oeis.org/A077460
|
|
206
|
+
"""
|
|
207
|
+
if n in {0, 1}:
|
|
208
|
+
foldsTotal = 1
|
|
209
|
+
elif n & 1:
|
|
210
|
+
foldsTotal = (A005315(n) + A005316(n) + A060206((n - 1) // 2)) // 4
|
|
211
|
+
else:
|
|
212
|
+
foldsTotal = (A005315(n) + 2 * A005316(n)) // 4
|
|
213
|
+
return foldsTotal
|
|
92
214
|
|
|
93
215
|
def A078591(n: int) -> int:
|
|
94
|
-
|
|
216
|
+
"""
|
|
217
|
+
Compute A078591(n) as a function of A005315.
|
|
218
|
+
|
|
219
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A078591 is: "Number of nonisomorphic ways a loop can cross a road (running East-West) 2n times."
|
|
220
|
+
|
|
221
|
+
The domain of A078591 starts at 0, therefore for values of `n` < 0, a(n) is undefined. The smallest value of n for which a(n)
|
|
222
|
+
has not yet been computed is 29.
|
|
223
|
+
|
|
224
|
+
Parameters
|
|
225
|
+
----------
|
|
226
|
+
n : int
|
|
227
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
a(n) : int
|
|
232
|
+
Number of nonisomorphic ways a loop can cross a road (running East-West) 2n times.
|
|
233
|
+
|
|
234
|
+
Would You Like to Know More?
|
|
235
|
+
----------------------------
|
|
236
|
+
OEIS : webpage
|
|
237
|
+
https://oeis.org/A078591
|
|
238
|
+
"""
|
|
239
|
+
return A005315(n) // 2
|
|
95
240
|
|
|
96
241
|
def A178961(n: int) -> int:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
242
|
+
"""
|
|
243
|
+
Compute A178961(n) as a function of A001010.
|
|
244
|
+
|
|
245
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A178961 is: "Partial sums of A001010."
|
|
246
|
+
|
|
247
|
+
The domain of A178961 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
248
|
+
has not yet been computed is 53.
|
|
249
|
+
|
|
250
|
+
Parameters
|
|
251
|
+
----------
|
|
252
|
+
n : int
|
|
253
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
254
|
+
|
|
255
|
+
Returns
|
|
256
|
+
-------
|
|
257
|
+
a(n) : int
|
|
258
|
+
Partial sums of A001010.
|
|
259
|
+
|
|
260
|
+
Would You Like to Know More?
|
|
261
|
+
----------------------------
|
|
262
|
+
OEIS : webpage
|
|
263
|
+
https://oeis.org/A178961
|
|
264
|
+
"""
|
|
265
|
+
A001010valuesKnown: dict[int, int] = dictionaryOEISMeanders['A001010']['valuesKnown']
|
|
266
|
+
foldsTotal: int = 0
|
|
267
|
+
for n下i in range(1, n + 1):
|
|
268
|
+
foldsTotal += A001010valuesKnown[n下i]
|
|
269
|
+
return foldsTotal
|
|
103
270
|
|
|
104
271
|
def A223094(n: int) -> int:
|
|
105
|
-
|
|
106
|
-
|
|
272
|
+
"""
|
|
273
|
+
Compute A223094(n) as a function of A000136 and A000682.
|
|
274
|
+
|
|
275
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A223094 is: "Number of foldings of n labeled stamps in which leaf n is inwards."
|
|
276
|
+
|
|
277
|
+
The domain of A223094 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
278
|
+
has not yet been computed is 44.
|
|
279
|
+
|
|
280
|
+
Parameters
|
|
281
|
+
----------
|
|
282
|
+
n : int
|
|
283
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
284
|
+
|
|
285
|
+
Returns
|
|
286
|
+
-------
|
|
287
|
+
a(n) : int
|
|
288
|
+
Number of foldings of n labeled stamps in which leaf n is inwards.
|
|
289
|
+
|
|
290
|
+
Would You Like to Know More?
|
|
291
|
+
----------------------------
|
|
292
|
+
OEIS : webpage
|
|
293
|
+
https://oeis.org/A223094
|
|
294
|
+
"""
|
|
295
|
+
return A000136(n) - A000682(n + 1)
|
|
107
296
|
|
|
108
297
|
def A259702(n: int) -> int:
|
|
109
|
-
|
|
298
|
+
"""
|
|
299
|
+
Compute A259702(n) as a function of A000682.
|
|
300
|
+
|
|
301
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A259702 is: "Row sums of A259701 except first column."
|
|
302
|
+
|
|
303
|
+
The domain of A259702 starts at 2, therefore for values of `n` < 2, a(n) is undefined. The smallest value of n for which a(n)
|
|
304
|
+
has not yet been computed is 33.
|
|
305
|
+
|
|
306
|
+
Parameters
|
|
307
|
+
----------
|
|
308
|
+
n : int
|
|
309
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
310
|
+
|
|
311
|
+
Returns
|
|
312
|
+
-------
|
|
313
|
+
a(n) : int
|
|
314
|
+
Row sums of A259701 except first column.
|
|
315
|
+
|
|
316
|
+
Would You Like to Know More?
|
|
317
|
+
----------------------------
|
|
318
|
+
OEIS : webpage
|
|
319
|
+
https://oeis.org/A259702
|
|
320
|
+
"""
|
|
321
|
+
return A000682(n) // 2 - A000682(n - 1)
|
|
110
322
|
|
|
111
323
|
def A301620(n: int) -> int:
|
|
112
|
-
|
|
113
|
-
|
|
324
|
+
"""
|
|
325
|
+
Compute A301620(n) as a function of A000682.
|
|
326
|
+
|
|
327
|
+
*The On-Line Encyclopedia of Integer Sequences* (OEIS) description of A301620 is: "a(n) is the total number of top arches with exactly one covering arch for semi-meanders with n top arches."
|
|
328
|
+
|
|
329
|
+
The domain of A301620 starts at 1, therefore for values of `n` < 1, a(n) is undefined. The smallest value of n for which a(n)
|
|
330
|
+
has not yet been computed is 44.
|
|
331
|
+
|
|
332
|
+
Parameters
|
|
333
|
+
----------
|
|
334
|
+
n : int
|
|
335
|
+
Index (n-dex) for a(n) in the sequence of values. "n" (lower case) and "a(n)" are conventions in mathematics.
|
|
336
|
+
|
|
337
|
+
Returns
|
|
338
|
+
-------
|
|
339
|
+
a(n) : int
|
|
340
|
+
a(n) is the total number of top arches with exactly one covering arch for semi-meanders with n top arches.
|
|
341
|
+
|
|
342
|
+
Would You Like to Know More?
|
|
343
|
+
----------------------------
|
|
344
|
+
OEIS : webpage
|
|
345
|
+
https://oeis.org/A301620
|
|
346
|
+
"""
|
|
347
|
+
return A000682(n + 2) - 2 * A000682(n + 1)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Compute a(n) for an OEIS ID by computing other OEIS IDs.
|
|
2
|
+
|
|
3
|
+
TODO Implement A178961 for unknown values of A001010
|
|
4
|
+
TODO A223094 For n >= 3: a(n) = n! - Sum_{k=3..n-1} (a(k)*n!/k!) - A000682(n+1). - _Roger Ford_, Aug 24 2024
|
|
5
|
+
TODO A301620 a(n) = Sum_{k=3..floor((n+3)/2)} (A259689(n+1,k)*(k-2)). - _Roger Ford_, Dec 10 2018
|
|
6
|
+
"""
|
|
7
|
+
from functools import cache
|
|
8
|
+
from mapFolding import countFolds, dictionaryOEISMeanders
|
|
9
|
+
from mapFolding.basecamp import A000682, A005316
|
|
10
|
+
|
|
11
|
+
@cache
|
|
12
|
+
def A000136(n: int) -> int:
|
|
13
|
+
"""A000682"""
|
|
14
|
+
return n * A000682(n)
|
|
15
|
+
|
|
16
|
+
def A000560(n: int) -> int:
|
|
17
|
+
"""A000682"""
|
|
18
|
+
return A000682(n + 1) // 2
|
|
19
|
+
|
|
20
|
+
def A001010(n: int) -> int:
|
|
21
|
+
"""A000682 or A007822"""
|
|
22
|
+
if n == 1:
|
|
23
|
+
foldsTotal = 1
|
|
24
|
+
elif n & 0b1:
|
|
25
|
+
foldsTotal = 2 * countFolds(oeisID='A007822', oeis_n=(n - 1)//2 + 1, flow='theorem2Numba')
|
|
26
|
+
else:
|
|
27
|
+
foldsTotal = 2 * A000682(n // 2 + 1)
|
|
28
|
+
return foldsTotal
|
|
29
|
+
|
|
30
|
+
def A001011(n: int) -> int:
|
|
31
|
+
"""A000136 and A001010"""
|
|
32
|
+
if n == 0:
|
|
33
|
+
foldsTotal = 1
|
|
34
|
+
else:
|
|
35
|
+
foldsTotal = (A001010(n) + A000136(n)) // 4
|
|
36
|
+
return foldsTotal
|
|
37
|
+
|
|
38
|
+
@cache
|
|
39
|
+
def A005315(n: int) -> int:
|
|
40
|
+
"""A005316"""
|
|
41
|
+
if n == 1:
|
|
42
|
+
foldsTotal = 1
|
|
43
|
+
else:
|
|
44
|
+
foldsTotal = A005316(2 * n - 1)
|
|
45
|
+
return foldsTotal
|
|
46
|
+
|
|
47
|
+
def A060206(n: int) -> int:
|
|
48
|
+
"""A000682"""
|
|
49
|
+
return A000682(2 * n + 1)
|
|
50
|
+
|
|
51
|
+
def A077460(n: int) -> int:
|
|
52
|
+
"""A005315, A005316, and A060206"""
|
|
53
|
+
if n in {0, 1}:
|
|
54
|
+
foldsTotal = 1
|
|
55
|
+
elif n & 0b1:
|
|
56
|
+
foldsTotal = (A005315(n) + A005316(n) + A060206((n - 1) // 2)) // 4
|
|
57
|
+
else:
|
|
58
|
+
foldsTotal = (A005315(n) + 2 * A005316(n)) // 4
|
|
59
|
+
|
|
60
|
+
return foldsTotal
|
|
61
|
+
|
|
62
|
+
def A078591(n: int) -> int:
|
|
63
|
+
"""A005315"""
|
|
64
|
+
return A005315(n) // 2
|
|
65
|
+
|
|
66
|
+
def A178961(n: int) -> int:
|
|
67
|
+
"""A001010"""
|
|
68
|
+
A001010valuesKnown: dict[int, int] = dictionaryOEISMeanders['A001010']['valuesKnown']
|
|
69
|
+
foldsTotal: int = 0
|
|
70
|
+
for n下i in range(1, n+1):
|
|
71
|
+
foldsTotal += A001010valuesKnown[n下i]
|
|
72
|
+
return foldsTotal
|
|
73
|
+
|
|
74
|
+
def A223094(n: int) -> int:
|
|
75
|
+
"""A000136 and A000682"""
|
|
76
|
+
return A000136(n) - A000682(n + 1)
|
|
77
|
+
|
|
78
|
+
def A259702(n: int) -> int:
|
|
79
|
+
"""A000682"""
|
|
80
|
+
return A000682(n) // 2 - A000682(n - 1)
|
|
81
|
+
|
|
82
|
+
def A301620(n: int) -> int:
|
|
83
|
+
"""A000682"""
|
|
84
|
+
return A000682(n + 2) - 2 * A000682(n + 1)
|