cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A287966 Number of Dyck paths of semilength n such that no level has more than two peaks.

This page as a plain text file.
%I A287966 #21 Mar 04 2024 14:58:51
%S A287966 1,1,2,4,12,31,90,264,797,2402,7355,22725,70573,220007,688379,2160568,
%T A287966 6798020,21428295,67644503,213806475,676499166,2142338437,6789119425,
%U A287966 21527297986,68292751071,216737768906,688082702872,2185085230180,6940609839680,22050162168754
%N A287966 Number of Dyck paths of semilength n such that no level has more than two peaks.
%H A287966 Alois P. Heinz, <a href="/A287966/b287966.txt">Table of n, a(n) for n = 0..1000</a>
%H A287966 Manosij Ghosh Dastidar and Michael Wallner, <a href="https://arxiv.org/abs/2402.17849">Bijections and congruences involving lattice paths and integer compositions</a>, arXiv:2402.17849 [math.CO], 2024. See p. 19.
%H A287966 Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>
%F A287966 a(n) = A287847(n,2).
%F A287966 a(n) = A000108(n) for n <= 2.
%t A287966 b[n_, k_, j_]:=b[n, k, j]=If[j==n, 1, Sum[b[n - j, k, i] Sum[Binomial[i, m] Binomial[j - 1, i - 1 - m], {m, Max[0, i - j], Min[k, i - 1]}], {i, Min[j + k, n - j]}]]; a[n_]:=If[n==0, 1, m=Min[n, 2]; Sum[b[n, m, j], {j, m}]]; Table[a[n], {n, 0, 50}] (* _Indranil Ghosh_, Aug 17 2017 *)
%o A287966 (Python)
%o A287966 from sympy.core.cache import cacheit
%o A287966 from sympy import binomial
%o A287966 @cacheit
%o A287966 def b(n, k, j): return 1 if j==n else sum(b(n - j, k, i)*sum(binomial(i, m)*binomial(j - 1, i - 1 - m) for m in range(max(0, i - j), min(k, i - 1) + 1)) for i in range(1, min(j + k, n - j) + 1))
%o A287966 def a(n):
%o A287966     if n==0: return 1
%o A287966     m=min(n, 2)
%o A287966     return sum(b(n, m , j) for j in range(1, m + 1))
%o A287966 print([a(n) for n in range(51)]) # _Indranil Ghosh_, Aug 17 2017
%Y A287966 Column k=2 of A287847.
%Y A287966 Cf. A000108.
%K A287966 nonn
%O A287966 0,3
%A A287966 _Alois P. Heinz_, Jun 03 2017