A049897 a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, where m = 2^(p+1) + 2 - n and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = a(2) = 1 and a(3) = 4.
1, 1, 4, 5, 10, 16, 33, 69, 138, 208, 452, 921, 1848, 3701, 7403, 14809, 29618, 44428, 96262, 196226, 394305, 789537, 1579543, 3159330, 6318730, 12637529, 25275094, 50550205, 101100416, 202200837, 404401675, 808803353, 1617606706
Offset: 1
Keywords
Programs
-
Maple
s := proc(n) option remember; `if`(n < 1, 0, a(n) + s(n - 1)) end proc: a := proc(n) option remember; `if`(n < 4, [1, 1, 4][n], s(n - 1) - a(2^ceil(log[2](n - 1)) + 2 - n)): end proc: seq(a(n), n = 1..40); # Petros Hadjicostas, Nov 14 2019
Extensions
Name edited by Petros Hadjicostas, Nov 14 2019