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.

A291885 Number of symmetrically unique Dyck paths of semilength 2n and height n.

This page as a plain text file.
%I A291885 #21 Apr 26 2021 08:01:20
%S A291885 1,1,5,31,252,2117,18546,164229,1469596,13229876,119712521,1087573357,
%T A291885 9914033252,90633332870,830621140260,7628813061585,70200092854044,
%U A291885 647070588612140,5973385906039684,55217660246861884,511054426374819184,4735208302827742549
%N A291885 Number of symmetrically unique Dyck paths of semilength 2n and height n.
%H A291885 Alois P. Heinz, <a href="/A291885/b291885.txt">Table of n, a(n) for n = 0..1026</a>
%F A291885 a(n) = A291883(2n,n).
%p A291885 b:= proc(x, y, k) option remember; `if`(x=0, 1, `if`(y+1<=min(k,
%p A291885         x-1), b(x-1, y+1, k), 0)+`if`(y>0, b(x-1, y-1, k), 0))
%p A291885     end:
%p A291885 g:= proc(x, y, k) option remember; `if`(x=0, 1, `if`(y>0,
%p A291885       g(x-2, y-1, k), 0)+ `if`(y+1<=k, g(x-2, y+1, k), 0))
%p A291885     end:
%p A291885 a:= n-> `if`(n=0, 1, (b(4*n, 0, n)  +g(4*n, 0, n)
%p A291885                      -b(4*n, 0, n-1)-g(4*n, 0, n-1))/2):
%p A291885 seq(a(n), n=0..30);
%t A291885 b[x_, y_, k_] := b[x, y, k] = If[x == 0, 1, If[y + 1 <= Min[k, x - 1], b[x - 1, y + 1, k], 0] + If[y > 0, b[x - 1, y - 1, k], 0]];
%t A291885 g[x_, y_, k_] := g[x, y, k] = If[x == 0, 1, If[y > 0, g[x - 2, y - 1, k], 0] + If[y + 1 <= k, g[x - 2, y + 1, k], 0]];
%t A291885 a[n_] := If[n == 0, 1, (b[4n, 0, n] + g[4n, 0, n] - b[4n, 0, n - 1] - g[4n, 0, n - 1])/2];
%t A291885 Array[a, 30, 0] (* _Jean-François Alcover_, May 31 2019, after _Alois P. Heinz_ *)
%o A291885 (Python)
%o A291885 from sympy.core.cache import cacheit
%o A291885 @cacheit
%o A291885 def b(x, y, k): return 1 if x==0 else (b(x - 1, y + 1, k) if y + 1<=min(k, x - 1) else 0) + (b(x - 1, y - 1, k) if y>0 else 0)
%o A291885 @cacheit
%o A291885 def g(x, y, k): return 1 if x==0 else (g(x - 2, y - 1, k) if y>0 else 0) + (g(x - 2, y + 1, k) if y + 1<=k else 0)
%o A291885 def a(n): return 1 if n==0 else (b(4*n, 0, n) + g(4*n, 0, n) - b(4*n, 0, n - 1) - g(4*n, 0, n - 1))//2
%o A291885 print([a(n) for n in range(31)]) # _Indranil Ghosh_, Sep 06 2017
%Y A291885 Cf. A291883.
%K A291885 nonn
%O A291885 0,3
%A A291885 _Alois P. Heinz_, Sep 05 2017