|
|
A289263
|
|
Number of maximal roller coasters in all n! permutations of n elements.
|
|
1
|
|
|
|
OFFSET
|
3,1
|
|
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.
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
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 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|