OFFSET
0,3
FORMULA
G.f. (1 + x^3 - x^5)/(1 - x - x^2 + x^3 - x^4 + x^6).
a(n) = a(n-2) + a(n-4) + a(n-5) + 1, a(0..4) = {1,1,2,3,5}.
a(n) = g(n) + sum(j=0..n-4, g(j) * sum(k=1..(n-j)/4, binomial(n-j-3*k-1, k-1))), g(j) = if(j<3,1,2) + floor(j/2).
EXAMPLE
The 5 walks of length 4 are (1,1,1,1),(1,1,1,-1),(1,1,-1,1),(1,1,-1,-1) and (1,-1,1,1).
MATHEMATICA
g[j_]:= If[j<3, 1, 2] + Floor[j/2]; Table[Sum[(g[j])*((Sum[Binomial[(n-j-3*k-1), k-1], {k, 1, (n-j)/4}])), {j, 0, n-4}] + g[n], {n, 0, 45}]
CoefficientList[Series[(1+x^3-x^5)/(1-x-x^2+x^3-x^4+x^6), {x, 0, 45}], x]
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
David Scambler, May 22 2012
STATUS
approved