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!)
A228614 Number of permutations of [n] having a shortest ascending run of length one. 4

%I #19 Aug 30 2021 03:11:05

%S 0,1,1,5,18,101,611,4452,36287,333395,3382758,37688597,456839351,

%T 5989023768,84421235807,1273482972215,20470309460322,349326503482301,

%U 6307682420743595,120157254334350828,2408293016265606623,50663563124372167787,1116225038923857181614

%N Number of permutations of [n] having a shortest ascending run of length one.

%H Alois P. Heinz, <a href="/A228614/b228614.txt">Table of n, a(n) for n = 0..200</a>

%F a(n) = A000142(n) - A097899(n).

%F E.g.f.: 1/(1-x) - sqrt(3)*exp(-x/2) / (2*cos(sqrt(3)*x/2+Pi/6)).

%e a(1) = 1: 1.

%e a(2) = 1: 21.

%e a(3) = 5: 132, 213, 231, 312, 321.

%e a(4) = 18: 1243, 1342, 1432, 2134, 2143, 2341, 2431, 3124, 3142, 3214, 3241, 3421, 4123, 4132, 4213, 4231, 4312, 4321.

%p g:= proc(u, o) option remember; `if`(u+o<2, u,

%p add(b(u-i, o+i-1), i=1..u) +add(g(u+i-1, o-i), i=1..o))

%p end:

%p b:= proc(u, o) option remember; `if`(u+o<2, 1-o,

%p u*(u+o-1)! +add(g(u+i-1, o-i), i=1..o))

%p end:

%p a:= n-> add(b(j-1, n-j), j=1..n):

%p seq(a(n), n=0..25);

%t g[u_, o_] := g[u, o] = If[u + o < 2, u,

%t Sum[b[u - i, o + i - 1], {i, u}] +

%t Sum[g[u + i - 1, o - i], {i, o}]];

%t b[u_, o_] := b[u, o] = If[u + o < 2, 1 - o, u*(u + o - 1)! +

%t Sum[g[u + i - 1, o - i], {i, o}]];

%t a[n_] := Sum[b[j - 1, n - j], {j, n}];

%t Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Aug 30 2021, after _Alois P. Heinz_ *)

%Y Column k=1 of A064315.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Aug 27 2013

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 July 28 07:11 EDT 2024. Contains 374676 sequences. (Running on oeis4.)