login
A049898
a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, where m = n - 1 - 2^p 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.
0
1, 1, 4, 5, 10, 20, 40, 77, 153, 310, 620, 1237, 2473, 4941, 9872, 19724, 39411, 78898, 157796, 315589, 631177, 1262349, 2524688, 5049356, 10098675, 20197274, 40394391, 80788472, 161576327, 323151418, 646300368, 1292595805
OFFSET
1,3
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(-1 + log[2](n - 1)) + n - 1)):
end proc:
seq(a(n), n = 1..40); # Petros Hadjicostas, Nov 19 2019
CROSSREFS
Sequence in context: A054173 A185875 A354080 * A166577 A242960 A288141
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 19 2019
STATUS
approved