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!)
A230130 Number of permutations of order n with the length of the longest run equal to 7. 3

%I #14 Aug 01 2022 16:20:21

%S 2,28,362,4720,64020,913440,13760472,219040274,3681354658,65231186514,

%T 1216489698082,23832126613268,489566931234322,10526180908026522,

%U 236475437787567496,5541690642862917134,135258139216049657102,3433304061341792767884,90508485528963754208076

%N Number of permutations of order n with the length of the longest run equal to 7.

%H Alois P. Heinz, <a href="/A230130/b230130.txt">Table of n, a(n) for n = 7..450</a>

%p g:= proc(u, o, t) option remember; `if`(u+o=0, 1,

%p add(g(o+j-1, u-j, 2), j=1..u) +`if`(t<7,

%p add(g(u+j-1, o-j, t+1), j=1..o), 0))

%p end:

%p b:= proc(u, o, t) option remember; `if`(t=7, g(u, o, t),

%p add(b(o+j-1, u-j, 2), j=1..u)+

%p add(b(u+j-1, o-j, t+1), j=1..o))

%p end:

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

%p seq(a(n), n=7..30);

%t length = 7;

%t g[u_, o_, t_] := g[u, o, t] = If[u+o == 0, 1, Sum[g[o + j - 1, u - j, 2], {j, 1, u}] + If[t<length, Sum[g[u + j - 1, o - j, t+1], {j, 1, o}], 0]];

%t b[u_, o_, t_] := b[u, o, t] = If[t == length, g[u, o, t], Sum[b[o + j - 1, u - j, 2], {j, 1, u}] + Sum[b[u + j - 1, o - j, t + 1], {j, 1, o}]];

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

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

%Y Column l=7 of A211318.

%Y A diagonal of A010026.

%K nonn

%O 7,1

%A _Alois P. Heinz_, Oct 10 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 April 19 16:03 EDT 2024. Contains 371794 sequences. (Running on oeis4.)