login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A212584
Nonnegative walks of length n on the x-axis starting at the origin using steps {1,-1} and visiting no point more than twice.
5
1, 1, 2, 3, 5, 6, 9, 12, 18, 24, 34, 46, 65, 89, 124, 170, 236, 325, 450, 620, 857, 1182, 1633, 2253, 3111, 4293, 5927, 8180, 11292, 15585, 21513, 29693, 40986, 56571, 78085, 107778, 148765, 205336, 283422, 391200, 539966, 745302, 1028725, 1419925, 1959892
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