OFFSET
0,4
COMMENTS
Each bisection is strictly monotonically increasing (see formula).
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..6000
FORMULA
a(n) = a(n - 2) + a(n/2) for even n >= 2; a(0) = 0.
a(n) = 2*a(n - 2) - a((n - 3)/2) + a(n - 1) for odd n >= 5; a(1) = 1; a(3) = 2.
EXAMPLE
a(6) = a(0) + a(1) + a(2) + a(3) = 0 + 1 + 1 + 2 = 4.
a(7) = a(3) + a(4) + a(5) + a(6) = 2 + 2 + 5 + 4 = 13.
a(8) = a(0) + a(1) + a(2) + a(3) + a(4) = 0 + 1 + 1 + 2 + 2 = 6.
a(9) = a(4) + a(5) + a(6) + a(7) + a(8) = 2 + 5 + 4 + 13 + 6 = 30.
PROG
(PARI) a(n) = if(n < 2, n, sum(k = 0, n\2, a(k + (n%2)*(n - 1)/2))) \\ or, much faster for large n:
a = [0, 1]; for(n = 2, 50, a = concat(a, sum(k = 0, n\2, a[k + 1 + (n%2)*(n - 1)/2]))); a
(Haskell)
a238834 n = a238834_list !! n
a238834_list = 0 : 1 : f True (drop 2 a008619_list) [1, 0] where
f p (t:ts) xs = y : f (not p) ts (y:xs)
where y = sum $ take t (if p then reverse xs else xs)
-- Reinhard Zumkeller, Mar 10 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Rick L. Shepherd, Mar 10 2014
STATUS
approved