login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A173258 Number of compositions of n where differences between neighboring parts are in {-1,1}. 20

%I #60 Oct 17 2023 15:48:26

%S 1,1,1,3,2,4,5,5,7,10,9,14,16,19,24,31,35,45,55,66,84,104,124,156,192,

%T 236,292,363,444,551,681,839,1040,1287,1586,1967,2430,3001,3717,4597,

%U 5683,7034,8697,10758,13312,16469,20369,25204,31180,38574,47726,59047

%N Number of compositions of n where differences between neighboring parts are in {-1,1}.

%H Alois P. Heinz, <a href="/A173258/b173258.txt">Table of n, a(n) for n = 0..5000</a>

%H John Tyler Rascoe, <a href="/A173258/a173258.pdf">Illustration of n = 1..16</a>

%F a(n) ~ c * d^n, where d=1.23729141259673487395949649334678514763130846902468..., c=1.134796087242490181499736234755111281606636700030106.... - _Vaclav Kotesovec_, May 01 2014

%F G.f.: 1 + Sum_{k>0} G(x,k) where G(x,k) = x^k*(1 + G(x,k+1) + G(x,k-1)) for k > 0 and G(x,0) = 0. - _John Tyler Rascoe_, Sep 16 2023

%e a(3) = 3: [3], [2,1], [1,2].

%e a(4) = 2: [4], [1,2,1].

%e a(5) = 4: [5], [3,2], [2,3], [2,1,2].

%e a(6) = 5: [6], [3,2,1], [2,1,2,1], [1,2,3], [1,2,1,2].

%p b:= proc(n, i) option remember;

%p `if`(n<1 or i<1, 0, `if`(n=i, 1, add(b(n-i, i+j), j=[-1, 1])))

%p end:

%p a:= n-> `if`(n=0, 1, add(b(n, j), j=1..n)):

%p seq(a(n), n=0..70);

%t b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n - i, i + j], {j, {-1, 1}}]]]; a[n_] := If[n == 0, 1, Sum[b[n, j], {j, 1, n}]]; Table[a[n], {n, 0, 70}] // Flatten (* _Jean-François Alcover_, Dec 13 2013, translated from Maple *)

%o (PARI)

%o step(R,n)={matrix(n, n, i, j, if(i>j, if(j>1, R[i-j, j-1]) + if(j+1<=n, R[i-j, j+1])) )}

%o a(n)={my(R=matid(n), t=(n==0), m=0); while(R, m++; t+=vecsum(R[n,]); R=step(R,n)); t} \\ _Andrew Howroyd_, Aug 23 2019

%Y Column k=1 of A214247, A214249.

%Y Row sums of A309938, A364039.

%Y Cf. A227310, A291904, A291905, A343795, A362500, A363718, A364529.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Jul 08 2012

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 18:17 EDT 2024. Contains 371962 sequences. (Running on oeis4.)