login
A049922
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) = 1, a(2) = 3 and a(3) = 2.
3
1, 3, 2, 5, 8, 18, 34, 69, 135, 274, 546, 1093, 2183, 4363, 8716, 17416, 34797, 69662, 139322, 278645, 557287, 1114571, 2229132, 4458248, 8916461, 17832856, 35665573, 71330874, 142661201, 285321312, 570640444, 1141276535, 2282544370
OFFSET
1,2
PROG
(PARI) lista(nn) = { my(va = vector(nn)); va[1] = 1; va[2] = 3; va[3] = 2; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa - va[n - 1 - 2^ceil(-1 + log(n-1)/log(2))]; sa += va[n]; ); va; } \\ Petros Hadjicostas, Apr 26 2020 (with nn > 2)
CROSSREFS
Cf. A049923 (similar, but with minus a(2*m)), A049970 (similar, but with plus a(m)), A049971 (similar, but with plus a(2*m)).
Sequence in context: A127299 A342138 A029619 * A160106 A243786 A278743
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Apr 26 2020
STATUS
approved