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.

A289263 Number of maximal roller coasters in all n! permutations of n elements.

Original entry on oeis.org

2, 26, 242, 2194, 21304, 226388, 2643008
Offset: 3

Views

Author

Daniel Krenn, Jul 01 2017

Keywords

Comments

A roller coaster is a pattern in a permutation (not necessarily consecutive) consisting of alternating up and down steps, with always at least two in one direction.
A maximal roller coaster is one that cannot be extended further.
Note that the singleton pattern (only one element) is not considered a roller coaster.
Examples:
- 123 and 321 are the only two (maximal) roller coasters in all permutations with 3 elements; see also the examples section. These patterns are the smallest two roller coasters that exist.
- The permutation 1536742 contains the maximal roller coasters 136742, 156742 and 532, no further maximal roller coaster.
- The permutation 163978524 contains among others the maximal roller coasters 124 and 137854. In total, this permutation has 14 maximal roller coasters.
- The permutation 1254367 is already a roller coaster, so the only maximal roller coaster is the permutation itself.

Examples

			For n = 3 the a(3) = 2 maximal roller coasters are 123 (of the permutation 123) and 321 (of the permutation 321); the permutations 132, 213, 231 and 312 do not contain any roller coaster pattern.
		

Programs

  • Mathematica
    rc[p_] := Block[{L = {}, s}, s = Select[Reverse@ Subsets[p, {2, Length@p}], Min[Length /@ Split[ Sign@ Differences@#]] >= 2 &]; Do[ If[ AllTrue[L, ! SubsetQ[#, e] &], AppendTo[L, e]], {e, s}]; Length@ L]; a[n_] := ParallelSum[rc@ p, {p, Permutations@ Range@ n}]; a /@ Range[3, 8] (* Giovanni Resta, Jul 05 2017 *)

Extensions

a(9) from Giovanni Resta, Jul 05 2017