editing
approved
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”).
editing
approved
Alois P. Heinz, <a href="/A276903/b276903.txt">Table of n, a(n) for n = 0..1437</a>
0, 1, 2, 7, 25, 96, 382, 1567, 6575, 28096, 121847, 534953, 2373032, 10619922, 47890013, 217395690, 992640367, 4555957948, 21007405327, 97266928685, 452046424465, 2108022305795, 9860773604035, 46256877824220, 217555982625385, 1025667805621986, 4846240583558277
nonn,more,walk,changed
proposed
editing
editing
proposed
A276903[n_] := (Do[walks[m, k, 2], {m, n}, {k, 2 m}]; walks[n, 2, 2]; ) (* Davin Park, Oct 10 2016 *)
proposed
editing
editing
proposed
dpwalks[n_, k_, h_] = 0;
dpwalks[1, k_, h_] := Boole[0 < k <= h];
dpwalks[n_, k_, h_] /; n >= 2 && k > 0 := dpwalks[n, k, h] = Sum[dpwalks[n - 1, k + x, h], {x, -h, h}];
(* walks represents the number of positive walks with n steps {-h, -h+1, ... , h} that end at altitude k *)
A276903[n_] := dpwalks[n, 2, 2]; (* Davin Park, Oct 10 2016 *)
proposed
editing
editing
proposed
dp[n_, k_, h_] = 0;
dp[1, k_, h_] := Boole[0 < k <= h];
dp[n_, k_, h_] /; n >= 2 && k > 0 := dp[n, k, h] = Sum[dp[n - 1, k + x, h], {x, -h, h}];
A276903[n_] := dp[n, 2, 2]; (* Davin Park, Oct 10 2016 *)
approved
editing