cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A350354 Number of up/down (or down/up) patterns of length n.

This page as a plain text file.
%I A350354 #19 Jun 03 2024 15:40:40
%S A350354 1,1,1,3,11,51,281,1809,13293,109899,1009343,10196895,112375149,
%T A350354 1341625041,17249416717,237618939975,3491542594727,54510993341523,
%U A350354 901106621474801,15723571927404189,288804851413993941,5569918636750820751,112537773142244706427
%N A350354 Number of up/down (or down/up) patterns of length n.
%C A350354 We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217. A patten is up/down if it is alternately strictly increasing and strictly decreasing, starting with an increase.
%C A350354 A pattern is up/down if it is alternately strictly increasing and strictly decreasing, starting with an increase. For example, the partition (3,2,2,2,1) has no up/down permutations, even though it does have the anti-run permutation (2,3,2,1,2).
%C A350354 Conjecture: Also the half the number of weakly up/down patterns of length n.
%C A350354 These are the values of the Euler zig-zag polynomials A205497 evaluated at x = 1/2 and normalized by 2^n. - _Peter Luschny_, Jun 03 2024
%H A350354 Andrew Howroyd, <a href="/A350354/b350354.txt">Table of n, a(n) for n = 0..200</a>
%F A350354 a(n > 2) = A344605(n)/2.
%F A350354 a(n > 1) = A345194(n)/2.
%e A350354 The a(0) = 1 through a(4) = 11 patterns:
%e A350354   ()  (1)  (1,2)  (1,2,1)  (1,2,1,2)
%e A350354                   (1,3,2)  (1,2,1,3)
%e A350354                   (2,3,1)  (1,3,1,2)
%e A350354                            (1,3,2,3)
%e A350354                            (1,3,2,4)
%e A350354                            (1,4,2,3)
%e A350354                            (2,3,1,2)
%e A350354                            (2,3,1,3)
%e A350354                            (2,3,1,4)
%e A350354                            (2,4,1,3)
%e A350354                            (3,4,1,2)
%p A350354 # Using the recurrence by _Kyle Petersen_ from A205497.
%p A350354 G := proc(n) option remember; local F;
%p A350354 if n = 0 then 1/(1 - q*x) else F := G(n - 1);
%p A350354 simplify((p/(p - q))*(subs({p = q, q = p}, F) - subs(p = q, F))) fi end:
%p A350354 A350354 := n -> 2^n*subs({p = 1, q = 1, x = 1/2}, G(n)*(1 - x)^(n + 1)):
%p A350354 seq(A350354(n), n = 0..22);  # _Peter Luschny_, Jun 03 2024
%t A350354 allnorm[n_]:=If[n<=0,{{}},Function[s, Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
%t A350354 updoQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]>y[[m+1]],y[[m]]<y[[m+1]]],{m,1,Length[y]-1}];
%t A350354 Table[Length[Select[Join@@Permutations/@allnorm[n],updoQ]],{n,0,6}]
%o A350354 (PARI)
%o A350354 F(p,x) = {sum(k=0, p, (-1)^((k+1)\2)*binomial((p+k)\2, k)*x^k)}
%o A350354 R(n,k) = {Vec(if(k==1, 0, F(k-2,-x)/F(k-1,x)-1) + x + O(x*x^n))}
%o A350354 seq(n)= {concat([1], sum(k=1, n, R(n, k)*sum(r=k, n, binomial(r, k)*(-1)^(r-k)) ))} \\ _Andrew Howroyd_, Feb 04 2022
%Y A350354 The version for permutations is A000111, undirected A001250.
%Y A350354 For compositions we have A025048, down/up A025049, undirected A025047.
%Y A350354 This is the up/down (or down/up) case of A345194.
%Y A350354 A205497 are the Euler zig-zag polynomials.
%Y A350354 A000670 counts patterns, ranked by A333217.
%Y A350354 A005649 counts anti-run patterns.
%Y A350354 A019536 counts necklace patterns.
%Y A350354 A226316 counts patterns avoiding (1,2,3), weakly A052709.
%Y A350354 A335515 counts patterns matching (1,2,3).
%Y A350354 A349058 counts weakly alternating patterns.
%Y A350354 A350252 counts non-alternating patterns.
%Y A350354 Row sums of A079502.
%Y A350354 Cf. A000041, A003242, A049774, A124754, A128761, A335457, A344604, A344605, A344615, A348610.
%K A350354 nonn
%O A350354 0,4
%A A350354 _Gus Wiseman_, Jan 16 2022
%E A350354 Terms a(10) and beyond from _Andrew Howroyd_, Feb 04 2022