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.

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

This page as a plain text file.
%I A007973 #33 Apr 12 2025 16:52:16
%S A007973 1,3,15,55,184,648,2111,6352,17337,42878,102050,239756,562728
%N A007973 Number of permutations that are n-2 "block reversals" away from 12...n.
%F A007973 a(n) = A300003(n,n-2).
%o A007973 (Python)
%o A007973 def a(n):
%o A007973     perm = tuple(range(1, n+1)); reach = {perm}; frontier = {perm}
%o A007973     for k in range(n-2):
%o A007973         r1 = set()
%o A007973         while len(frontier) > 0:
%o A007973             q = frontier.pop()
%o A007973             for i in range(n):
%o A007973                 for j in range(i+1, n+1):
%o A007973                     qp = list(q)
%o A007973                     qp[i:j] = qp[i:j][::-1]
%o A007973                     qp = tuple(qp)
%o A007973                     if qp not in reach:
%o A007973                         reach.add(qp)
%o A007973                         r1.add(qp)
%o A007973         frontier = r1
%o A007973     return len(frontier)
%o A007973 print([a(n) for n in range(2, 10)]) # _Michael S. Branicky_, Jan 26 2023
%Y A007973 Cf. A007972, A007974, A007975, A300003.
%K A007973 nonn,more
%O A007973 2,2
%A A007973 _J. H. Conway_
%E A007973 a(9)-a(11) from _Sean A. Irvine_, Feb 22 2018
%E A007973 a(12) from _Thomas Baruchel_, Mar 26 2025
%E A007973 a(13)-a(14) from _Bert Dobbelaere_, Apr 12 2025