login
A050028
a(n) = a(n-1) + a(m) for n >= 4, where m = 2*n - 3 - 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) = 2.
11
1, 1, 2, 3, 5, 6, 8, 13, 21, 22, 24, 29, 37, 58, 82, 119, 201, 202, 204, 209, 217, 238, 262, 299, 381, 582, 786, 1003, 1265, 1646, 2432, 3697, 6129, 6130, 6132, 6137, 6145, 6166, 6190, 6227, 6309, 6510, 6714, 6931, 7193, 7574, 8360
OFFSET
1,3
LINKS
MAPLE
a := proc(n) option remember;
if n < 4 then return [1, 1, 2][n]; end if;
a(n - 1) + a(2*n - 4 - Bits:-Iff(n - 2, n - 2)); end proc;
seq(a(n), n = 1 .. 50); # Petros Hadjicostas, Nov 08 2019
MATHEMATICA
Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 1, 2}, Flatten@Table[2 k - 1, {n, 5}, {k, 2^n}]] (* Ivan Neretin, Sep 06 2015 *)
PROG
(PARI) lista(nn) = {nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 1; va[3] = 2; for(n=4, nn, va[n] = va[n-1] + va[2*n - 3 - 2*2^logint(n-2, 2)]); va; } \\ Petros Hadjicostas, May 10 2020
CROSSREFS
Cf. A050024 (similar, but with different initial conditions).
Sequence in context: A364122 A034722 A144712 * A239135 A179791 A139443
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 08 2019
STATUS
approved