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