login
A238834
For n > 1 the sum of t := floor(n/2) + 1 consecutive previous terms, the leading t terms when n is even, the immediately-preceding t terms when n is odd; a(0) = 0, a(1) = 1.
1
0, 1, 1, 2, 2, 5, 4, 13, 6, 30, 11, 69, 15, 148, 28, 320, 34, 661, 64, 1380, 75, 2805, 144, 5743, 159, 11576, 307, 23444, 335, 47075, 655, 94777, 689, 189923, 1350, 381162, 1414, 763077, 2794, 1528884, 2869, 3059257, 5674, 6124113, 5818, 12251239, 11561, 24513895, 11720, 49033767
OFFSET
0,4
COMMENTS
Each bisection is strictly monotonically increasing (see formula).
LINKS
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
Cf. A008619.
Sequence in context: A112471 A144366 A054156 * A284686 A349451 A054079
KEYWORD
nonn
AUTHOR
Rick L. Shepherd, Mar 10 2014
STATUS
approved