login
A049889
a(n) = a(1) + a(2) + ... + a(n-1) - a(m), 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) = 2.
0
1, 1, 2, 3, 6, 10, 21, 43, 86, 130, 282, 575, 1154, 2311, 4623, 9247, 18494, 27742, 60108, 122528, 246213, 493005, 986303, 1972758, 3945560, 7891163, 15782348, 31564707, 63129418, 126258839, 252517679, 505035359, 1010070718, 1515106078, 3282729836, 6691718512, 13446566445
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, 2][n], s(n - 1) - a(2^ceil(log[2](n - 1)) + 2 - n)):
end proc:
seq(a(n), n = 1..34); # Petros Hadjicostas, Nov 09 2019
CROSSREFS
Sequence in context: A242563 A240513 A036650 * A014270 A127076 A137208
KEYWORD
nonn
EXTENSIONS
Name edited by and more terms from Petros Hadjicostas, Nov 09 2019
STATUS
approved