login
A049895
a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, where m = 2*n - 2 - 2^(p+1) 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) = 3.
3
1, 1, 3, 4, 5, 13, 23, 37, 50, 136, 269, 529, 1034, 1969, 3545, 5650, 7619, 20887, 41771, 83533, 167042, 333985, 667577, 1333714, 2663747, 5312257, 10561868, 20873284, 40746839, 77515135, 139469243, 222296635, 299811770, 821920174
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, 3][n],
s(n - 1) - a(-2^ceil(log[2](n - 1)) + 2*n - 2))
end proc:
seq(a(n), n = 1..40); # Petros Hadjicostas, Nov 19 2019
CROSSREFS
Cf. A049894 (similar, but with minus a(m/2)), A049942 (similar, but with plus a(m/2)), A049943 (similar, but with plus a(m)).
Sequence in context: A062201 A352908 A211518 * A365017 A226117 A221173
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 19 2019
STATUS
approved