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
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Petros Hadjicostas, Oct 01 2019
STATUS
approved