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!)
A307576 Number of Motzkin excursions of length n with an even number of peaks. 0
1, 1, 1, 2, 5, 11, 26, 65, 164, 421, 1101, 2912, 7777, 20957, 56891, 155418, 426975, 1178841, 3269023, 9101182, 25428895, 71279177, 200391716, 564899237, 1596399798, 4521769035, 12835037619, 36504130056, 104012102095, 296872273835, 848694416554, 2429884047993 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
A Motzkin excursion is a lattice path with steps from the set {D=-1, H=0, U=1} that starts at (0,0), never goes below the x-axis, and terminates at the altitude 0.
A peak is an occurrence of the pattern UD.
LINKS
FORMULA
G.f.: (2*(1-t+t^2) - sqrt((1+t)*(1-3*t)) - sqrt((1-t)*(1-2*t)*(1+t+2*t^2))) / (4*t^2).
D-finite with recurrence 2*n*(n+2)*(6213*n-138098)*a(n) +(n-1)*(12426*n^2+978417*n+821680)*a(n-1) +2*(-23065*n^3-728759*n^2+2760574*n-410840)*a(n-2) +2*(-292946*n^3 +3649919*n^2 -11479673*n +8929300)*a(n-3) +2*(233455*n^3 -3707982*n^2 +13757984*n -13497400)*a(n-4) +(608874*n^3 -5758645*n^2 +11199163*n +5963900)*a(n-5) +2*(848625*n^3 -11463971*n^2 +51225442*n -77109420)*a(n-6) -16*(n-7)*(2213*n^2 +270746*n -1493325)*a(n-7) -24*(88769*n -321795)*(n-7)*(n-8)*a(n-8)=0. - R. J. Mathar, Jan 25 2023
a(n) + A307578(n) = A001006(n). - R. J. Mathar, Jan 25 2023
EXAMPLE
For n = 4 the a(4) = 5 paths are HHHH, HUHD, UHDH, UHHD, UDUD.
MAPLE
b:= proc(x, y, t, c) option remember; `if`(y>x or y<0, 0, `if`(x=0, 1-c,
b(x-1, y-1, 0, irem(c+t, 2))+b(x-1, y, 0, c)+b(x-1, y+1, 1, c)))
end:
a:= n-> b(n, 0$3):
seq(a(n), n=0..35); # Alois P. Heinz, Apr 15 2019
MATHEMATICA
b[x_, y_, t_, c_] := b[x, y, t, c] = If[y > x || y < 0, 0, If[x == 0, 1-c, b[x-1, y-1, 0, Mod[c+t, 2]] + b[x-1, y, 0, c] + b[x-1, y+1, 1, c]]];
a[n_] := b[n, 0, 0, 0];
a /@ Range[0, 35] (* Jean-François Alcover, May 12 2020, after Maple *)
CROSSREFS
Cf. A001006.
Sequence in context: A235496 A025245 A300125 * A079223 A095892 A239311
KEYWORD
nonn
AUTHOR
Andrei Asinowski, Apr 15 2019
STATUS
approved

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 23 22:36 EDT 2024. Contains 371917 sequences. (Running on oeis4.)