A289263 Number of maximal roller coasters in all n! permutations of n elements.
2, 26, 242, 2194, 21304, 226388, 2643008
Offset: 3
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.
Links
- Daniel Krenn, sequences-roller-coasters, program in SageMath, on GitHub.
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
Comments