Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #26 May 15 2021 06:17:55
%S 1,1,0,1,1,0,2,1,1,3,2,3,4,4,6,8,8,11,14,16,21,26,32,39,49,60,75,93,
%T 114,142,176,217,268,334,411,510,632,779,967,1196,1477,1832,2266,2801,
%U 3470,4291,5310,6572,8129,10061,12449,15401,19058,23581,29178,36102,44668
%N Row sums of A291904.
%C Number of compositions of n where the first part is 1 and the absolute difference between consecutive parts is 1.
%H Seiichi Manyama, <a href="/A291905/b291905.txt">Table of n, a(n) for n = 0..10000</a>
%e The a(6)=2 compositions of 6 are:
%e :
%e : o o|
%e : oooo|
%e :
%e : o|
%e : oo|
%e : ooo|
%e :
%e The a(9)=3 compositions of 9 are:
%e :
%e : o |
%e : ooo |
%e : ooooo|
%e :
%e : o o o|
%e : oooooo|
%e :
%e : o|
%e : o oo|
%e : ooooo|
%p b:= proc(n, i) option remember; `if`(n=0, 1, add(
%p `if`(j=i, 0, b(n-j, j)), j=max(1, i-1)..min(i+1, n)))
%p end:
%p a:= n-> b(n, 0):
%p seq(a(n), n=0..60); # _Alois P. Heinz_, Sep 05 2017
%t T[0, 0] = 1; T[_, 0] = 0; T[n_?Positive, k_] /; 0 < k <= Floor[(Sqrt[8n+1] - 1)/2] := T[n, k] = T[n-k, k-1] + T[n-k, k+1]; T[_, _] = 0;
%t a[n_] := Sum[T[n, k], {k, 0, Floor[(Sqrt[8n+1] - 1)/2]}];
%t Table[a[n], {n, 0, 60}] (* _Jean-François Alcover_, May 29 2019 *)
%o (Python)
%o from sympy.core.cache import cacheit
%o @cacheit
%o def b(n, i): return 1 if n==0 else sum(b(n - j, j) for j in range(max(1, i - 1), min(i + 1, n) + 1) if j != i)
%o def a(n): return b(n, 0)
%o print([a(n) for n in range(61)]) # _Indranil Ghosh_, Sep 06 2017, after Maple program
%Y Cf. A291896, A291904.
%K nonn
%O 0,7
%A _Seiichi Manyama_, Sep 05 2017