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.

A007974 Number of permutations that are n-3 "block reversals" away from 12...n.

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