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.

A291905 Row sums of A291904.

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