OFFSET
1,3
COMMENTS
LINKS
R. L. Graham, On sorting by comparisons, in Proceedings of the ATLAS Symposium, 1971, pp. 263-269
F. K. Hwang, Optimal merging of 3 elements with n elements, SIAM J. Comput. 9 (1980), no. 2, 298--320. MR0568816 (82c:68022).
Frank K. Hwang and David N. Deutsch, A class of merging algorithms, Journal of the ACM (JACM) 20.1 (1973): 148-159. See "O" page 157.
F. K. Hwang and S. Lin, Optimal merging of 2 elements with n elements, Acta Informatica, 1 (1971), 145-158.
Index entries for linear recurrences with constant coefficients, signature (1,1,-1,1,-1,2,-2).
FORMULA
If n mod 2 = 0 then set k:=n/2 and a(n) = floor(17*2^(k-1)/7) - 1; otherwise set k:=(n+1)/2 and a(n) = floor(12*2^(k-1)/7) - 1.
G.f.: x^2*(1+x+x^3+x^4+x^5) / ( (x-1)*(2*x^2-1)*(1+x+x^2)*(x^2-x+1) ). - R. J. Mathar, Nov 15 2011
From Wesley Ivan Hurt, Mar 24 2015: (Start)
a(n) = a(n-1)+a(n-2)-a(n-3)+a(n-4)-a(n-5)+2*a(n-6)-2*a(n-7).
a(n) = floor((29+5(-1)^n)*2^((2n-7-(-1)^n)/4)/7)-1. (End)
MAPLE
MATHEMATICA
Table[Floor[(29 + 5 (-1)^n)*2^((2n - 7 - (-1)^n)/4)/7] - 1, {n, 50}] (* Wesley Ivan Hurt, Mar 24 2015 *)
CoefficientList[Series[x (1 + x + x^3 + x^4 + x^5) / ((x - 1)(2 x^2 - 1) (1 + x + x^2) (x^2 - x + 1)), {x, 0, 50}], x] (* Vincenzo Librandi, Mar 25 2015 *)
PROG
(Magma) [Floor((29+5*(-1)^n)*2^((2*n-7-(-1)^n)/4)/7)-1 : n in [1..50]]; // Wesley Ivan Hurt, Mar 24 2015
(Magma) I:=[0, 1, 2, 3, 5, 8, 12]; [n le 7 select I[n] else Self(n-1)+Self(n-2)-Self(n-3)+Self(n-4)-Self(n-5)+2*Self(n-6)-2*Self(n-7): n in [1..50]]; // Vincenzo Librandi, Mar 25 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Nov 15 2011
STATUS
approved