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.

This page as a plain text file.
%I A289263 #35 Jul 05 2017 15:52:44
%S A289263 2,26,242,2194,21304,226388,2643008
%N A289263 Number of maximal roller coasters in all n! permutations of n elements.
%C A289263 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.
%C A289263 A maximal roller coaster is one that cannot be extended further.
%C A289263 Note that the singleton pattern (only one element) is not considered a roller coaster.
%C A289263 Examples:
%C A289263 - 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.
%C A289263 - The permutation 1536742 contains the maximal roller coasters 136742, 156742 and 532, no further maximal roller coaster.
%C A289263 - The permutation 163978524 contains among others the maximal roller coasters 124 and 137854. In total, this permutation has 14 maximal roller coasters.
%C A289263 - The permutation 1254367 is already a roller coaster, so the only maximal roller coaster is the permutation itself.
%H A289263 Daniel Krenn, <a href="https://github.com/dkrenn/sequences-roller-coasters">sequences-roller-coasters</a>, program in SageMath, on GitHub.
%e A289263 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.
%t A289263 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 *)
%K A289263 nonn,more
%O A289263 3,1
%A A289263 _Daniel Krenn_, Jul 01 2017
%E A289263 a(9) from _Giovanni Resta_, Jul 05 2017