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!)
A007973 Number of permutations that are n-2 "block reversals" away from 12...n. 4

%I #21 Jan 26 2023 16:14:08

%S 1,3,15,55,184,648,2111,6352,17337,42878

%N Number of permutations that are n-2 "block reversals" away from 12...n.

%F a(n) = A300003(n,n-2).

%o (Python)

%o def a(n):

%o perm = tuple(range(1, n+1)); reach = {perm}; frontier = {perm}

%o for k in range(n-2):

%o r1 = set()

%o while len(frontier) > 0:

%o q = frontier.pop()

%o for i in range(n):

%o for j in range(i+1, n+1):

%o qp = list(q)

%o qp[i:j] = qp[i:j][::-1]

%o qp = tuple(qp)

%o if qp not in reach:

%o reach.add(qp)

%o r1.add(qp)

%o frontier = r1

%o return len(frontier)

%o print([a(n) for n in range(2, 10)]) # _Michael S. Branicky_, Jan 26 2023

%Y Cf. A007972, A007974, A007975, A300003.

%K nonn,more

%O 2,2

%A _J. H. Conway_

%E a(9)-a(11) from _Sean A. Irvine_, Feb 22 2018

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