OFFSET
1,2
COMMENTS
"Twice" is included in the definition to handle half-integer medians.
LINKS
Vaclav Kotesovec, Table of n, a(n) for n = 1..700
Vaclav Kotesovec, Plot of a(n)/a(n-1) for n = 2..1000
EXAMPLE
For n = 6, {Stirling2(6, k), k = 0..6} = {0, 1, 31, 90, 65, 15, 1}, so we have 3 elements {0, 1, 1} that are < 15, and 3 elements {31, 90, 65} that are > 15. Hence, 15 is the median, and a(6) = 2*15 = 30.
MAPLE
a:= n->(l->l[floor(1+n/2)]+l[ceil(1+n/2)])(sort([seq(Stirling2(n, j), j=0..n)])):
seq(a(n), n=1..30); # Alois P. Heinz, Sep 16 2019
MATHEMATICA
Table[2 Median[Table[StirlingS2[n, k], {k, 0, n}]], {n, 1, 30}]
PROG
(PARI) a(n)={my(t=vecsort(vector(n+1, k, stirling(n, k-1, 2)))); t[n\2+1] + t[n-n\2+1]} \\ Andrew Howroyd, Sep 16 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vladimir Reshetnikov, Sep 16 2019
STATUS
approved