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.

A186371 Number of up-down runs in all permutations of {1,2,...,n}.

This page as a plain text file.
%I A186371 #17 Sep 08 2022 08:45:55
%S A186371 0,1,3,13,68,420,3000,24360,221760,2237760,24796800,299376000,
%T A186371 3911846400,55005350400,828193766400,13294689408000,226663557120000,
%U A186371 4090405423104000,77895546753024000,1561112121913344000,32844177110384640000,723788347432550400000
%N A186371 Number of up-down runs in all permutations of {1,2,...,n}.
%C A186371 The up-down runs of a permutation p are the alternating runs of the permutation p endowed with a 0 in the front. For example, 75814632 has 6 up-down runs: 07, 75, 58, 81, 146, and 632.
%F A186371 a(n) = Sum_{k=1..n} k*A186370(n,k).
%F A186371 a(n) = n!*(4n+1)/6 for n>=2.
%F A186371 E.g.f.: g(z) = z(6-3z+z^2)/[6(1-z)^2].
%F A186371 D-finite with recurrence 4*a(n) +(-4*n-7)*a(n-1) +3*(n-1)*a(n-2)=0. - _R. J. Mathar_, Jul 22 2022
%e A186371 a(3)=13 because the permutations 123, 132, 213, 231, 312, and 321 have a total of 1 + 2 + 3 + 2 + 3 + 2 = 13 up-down runs.
%p A186371 0, 1, seq((1/6)*factorial(n)*(4*n+1), n = 2 .. 20);
%t A186371 Join[{0, 1}, Table[n! (4 n + 1)/6, {n, 2, 20}]] (* _Vincenzo Librandi_, Sep 11 2015 *)
%o A186371 (Magma) [0,1] cat [Factorial(n)*(4*n+1)/6: n in [2..30]]; // _Vincenzo Librandi_, Sep 11 2015
%Y A186371 Cf. A186370, A097971.
%K A186371 nonn,easy
%O A186371 0,3
%A A186371 _Emeric Deutsch_ and _Ira M. Gessel_, Mar 01 2011