OFFSET
1,2
LINKS
Clark Kimberling, Table of n, a(n) for n = 1..2000
Index entries for linear recurrences with constant coefficients, signature (0,3,0,-3,0,1).
FORMULA
a(n) = (n+1)/2 if n is odd, a(n) = n*(n/2+1) if n is even.
G.f.: W(0), where W(k)= 1 + 2*x*(k+2)/( 1 - x/(x + 2*(k+1)/W(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Aug 16 2013
a(n) = 3*a(n-2)-3*a(n-4)+a(n-6). - Colin Barker, Feb 27 2015
G.f.: x*(x^2-4*x-1) / ((x-1)^3*(x+1)^3). - Colin Barker, Feb 27 2015
a(n) = n^(1/2 + (-1)^n/2)*(n + 2^(1/2 + (-1)^n/2))/2. - Wesley Ivan Hurt, Feb 27 2015
a(n) = Sum_{k=0..n} (-1)^k * A061579(n,k). - Alois P. Heinz, Feb 10 2023
EXAMPLE
median{1, 1/2, 1/3, 1/4} = (1/2 + 1/3)/2 = 7/12, so that a(4) = 12.
MAPLE
A226725:=n->n^(1/2 + (-1)^n/2)*(n + 2^(1/2 + (-1)^n/2))/2: seq(A226725(n), n=1..100); # Wesley Ivan Hurt, Feb 27 2015
MATHEMATICA
Denominator[Table[Median[Table[1/k, {k, n}]], {n, 120}]]
f[n_] := If[ OddQ@ n, Floor[(n + 1)/2], n(n/2 + 1)]; Array[f, 59] (* Robert G. Wilson v, Feb 27 2015 *)
With[{nn=30}, Riffle[Range[nn], Table[2n+2n^2, {n, nn}]]] (* Harvey P. Dale, May 26 2019 *)
Riffle[Range[60], LinearRecurrence[{3, -3, 1}, {4, 12, 24}, 60]] (* Harvey P. Dale, Oct 03 2023 *)
PROG
(PARI) Vec(x*(x^2-4*x-1)/((x-1)^3*(x+1)^3) + O(x^100)) \\ Colin Barker, Feb 27 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jun 19 2013
EXTENSIONS
Formula changed for even terms by Luca Brigada Villa, Jun 20 2013
STATUS
approved