A216256 Minimum length of a longest unimodal subsequence of a permutation of n elements.
1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15
Offset: 1
Examples
a(3) = 3 because all permutations of 3 elements are unimodal. a(4) = 3 because there are permutations of 4 elements (e.g., 1423) that are not unimodal, but using the previous value we can always fix that by deleting one element.
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
- F. R. K. Chung, On unimodal subsequences, Journal of Combinatorial Theory, Series A, 279 (1980), pp. 267-279.
Crossrefs
Cf. A004396.
Programs
-
C
unsigned int a(unsigned int n) { return ceil( sqrt((double) 3*n - 0.75) - 0.5); }
-
Magma
[Ceiling(Sqrt(3*n - 3/4) - 1/2) : n in [1..100]]; // Wesley Ivan Hurt, Oct 16 2015
-
Maple
A216256:=n->ceil(sqrt(3*n - 3/4) - 1/2): seq(A216256(n), n=1..100); # Wesley Ivan Hurt, Oct 16 2015
-
Mathematica
Table[Ceiling[Sqrt[3 n - 3/4] - 1/2], {n, 100}] (* Wesley Ivan Hurt, Oct 16 2015 *)
-
PARI
a(n) = ceil(sqrt(3*n-3/4) - 1/2); \\ Michel Marcus, Apr 22 2014
Formula
a(n) = ceiling(sqrt(3*n - 3/4) - 1/2).
Comments