login
A049938
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), with a(1) = a(2) = 1 and a(3) = 2.
3
1, 1, 2, 5, 10, 20, 40, 81, 165, 326, 652, 1305, 2613, 5231, 10472, 20964, 41969, 83858, 167716, 335433, 670869, 1341743, 2683496, 5367012, 10734065, 21468214, 42936589, 85873504, 171747661, 343496630, 686995878, 1373996997, 2748004486, 5495988009, 10991976018, 21983952037, 43967904077
OFFSET
1,3
FORMULA
a(n) = a(n - 1 - 2^ceiling(-1 + log_2(n-1))) + Sum_{i = 1..n-1} a(i) = a((1 + A006257(n-2))/2) + Sum_{i = 1..n-1} a(i) for n >= 4 with a(1) = a(2) = 1 and a(3) = 2. - Petros Hadjicostas, Oct 01 2019
EXAMPLE
From Petros Hadjicostas, Oct 01 2019: (Start)
a(4) = a(4 - 1 - 2^ceiling(-1 + log_2(3))) + a(1) + a(2) + a(3) = a(1) + a(1) + a(2) + a(3) = 5.
a(5) = a(5 - 1 - 2^ceiling(-1 + log_2(4))) + a(1) + a(2) + a(3) + a(4) = a(2) + a(1) + a(2) + a(3) + a(4) = 10.
a(6) = a(6 - 1 - 2^ceiling(-1 + log_2(5))) + a(1) + a(2) + a(3) + a(4) + a(5) = a(1) + a(1) + a(2) + a(3) + a(4) + a(5) = 20.
(End)
MAPLE
a := proc(n) local i; option remember; if n < 4 then return [1, 1, 2][n]; end if; add(a(i), i = 1 .. n - 1) + a(n - 3/2 - 1/2*Bits:-Iff(n - 2, n - 2)); end proc; # Petros Hadjicostas, Oct 01 2019
PROG
(PARI) lista(nn) = { nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 1; 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 27 2020
CROSSREFS
Cf. A006257, A049890 (similar, but with minus a(m)), A049891 (similar, but with minus a(2*m)), A049939 (similar, but with plus a(2*m)), A049940, A049960, A049964, A049978.
Sequence in context: A284904 A084215 A024810 * A002460 A266613 A266462
KEYWORD
nonn
EXTENSIONS
More terms from Petros Hadjicostas, Oct 01 2019
STATUS
approved