OFFSET
0,4
LINKS
Hsien-Kuei Hwang, S. Janson, T.-H. Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint 2016.
Hsien-Kuei Hwang, S. Janson, T.-H. Tsai, Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585. See Ex. 7.4.
MAPLE
f:=proc(n) option remember;
if n <= 1 then 0
elif (n mod 4 = 0) then f(n/2-1)+f(n/2+1)+n/2;
else f(floor(n/2))+f(ceil(n/2))+floor(n/2);
fi; end;
[seq(f(n), n=0..60)];
MATHEMATICA
a[n_] := a[n] = If[Mod[n, 4] == 0, a[n/2 -1] + a[n/2 +1] + n/2, a[Floor[n/2]] + a[Ceiling[n/2]] + Floor[n/2]]; a[0] = a[1] = 0; Array[a, 61, 0] (* Robert G. Wilson v, Dec 10 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Nov 26 2017
STATUS
approved