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!)
A296619 The number of nonnegative walks of n steps with step sizes 1 and 2, starting at 0 and ending at 2. 3

%I #57 Apr 29 2018 21:38:09

%S 0,1,1,6,13,52,152,550,1813,6453,22427,80330,286895,1038931,3772801,

%T 13807294,50726893,187332517,694364517,2583714636,9644852364,

%U 36115537269,135607526865,510496492338,1926284451923,7284476707597,27602839227883,104791979218326

%N The number of nonnegative walks of n steps with step sizes 1 and 2, starting at 0 and ending at 2.

%C a(n) is the number of 2-D walks with n steps of type {(1,-2), (1,-1), (1,1), or (1,2)} starting at (0,0), ending at (n,2), and not dropping below the x-axis.

%C The sequence corresponds to element (1,3) of the matrix B(n)^n (see Maple script). Furthermore, element (1,1) of the matrix is A187430, the element (1,2) of these matrix is A055113.

%H Robert Israel, <a href="/A296619/b296619.txt">Table of n, a(n) for n = 0..1667</a>

%F a(n) = A185286(n,2). - _Robert Israel_, Dec 19 2017

%e There are 6 walks of length 3:

%e __

%e | | __

%e __| |_ __| |_ __ _

%e | | | |__|

%e _| _| _|

%e 2+2-2=2 2+1-1=2 2-1+1=2

%e __

%e __ _ | |_ _

%e | | | __| __ |

%e _| |__| _| _| |__|

%e 2-2+2=2 1+2-1=2 1-1+2=2

%p B := n -> LinearAlgebra:-ToeplitzMatrix([0,1,1, seq(0, k=0..n-2)], symmetric):

%p seq((B(n)^n)(1, 3), n=0..27);

%p # alternative:

%p T:= proc(n,k) option remember;

%p if k < 0 or k > 2*n then return 0 fi;

%p procname(n-1,k-2)+procname(n-1,k-1)+procname(n-1,k+1)+procname(n-1,k+2)

%p end proc:

%p T(0,0):= 1:

%p seq(T(n,2),n=0..40); # _Robert Israel_, Dec 19 2017

%t b[n_] := ToeplitzMatrix[Join[{0,1,1}, ConstantArray[0,n-1]]];

%t Prepend[Table[MatrixPower[b[n],n][[1,3]], {n,20}], 0]

%t (* _Andrey Zabolotskiy_, Dec 19 2017 *)

%o (PARI)

%o Next(v)={vector(#v+2, i, if(i<3||i>#v-2, 0, v[i-2]+v[i-1]+v[i+1]+v[i+2]))}

%o my(v=vector(7,i,i==3)); for(n=1, 50, print1(v[5],", "); v=Next(v)) \\ _Andrew Howroyd_, Dec 18 2017

%Y Cf. A055113, A185286, A187430.

%K nonn,walk

%O 0,4

%A _Feng Jishe_, Dec 17 2017

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 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)