login
A050038
a(n) = 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) = a(2) = 1 and a(3) = 4.
3
1, 1, 4, 5, 6, 7, 8, 12, 17, 18, 19, 23, 28, 34, 41, 49, 61, 62, 63, 67, 72, 78, 85, 93, 105, 122, 140, 159, 182, 210, 244, 285, 334, 335, 336, 340, 345, 351, 358, 366, 378, 395, 413, 432, 455, 483, 517, 558
OFFSET
1,3
LINKS
MATHEMATICA
Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 1, 4}, Flatten@Table[k, {n, 5}, {k, 2^n}]] (* Ivan Neretin, Sep 08 2015 *)
PROG
(PARI) lista(nn) = {nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 1; va[3] = 4; for(n=4, nn, va[n] = va[n-1] + va[n - 1 - 2^logint(n-2, 2)]); va; } \\ Petros Hadjicostas, May 15 2020
CROSSREFS
Cf. similar sequences with different initial conditions: A050026 (1,1,1), A050030 (1,1,2), A050034 (1,1,3), A050038 (1,1,4), A050042 (1,2,1), A050046 (1,2,2), A050054 (1,2,4), A050058 (1,3,1), A050062 (1,3,2), A050066 (1,3,3), A050070 (1,3,4).
Sequence in context: A073073 A213525 A047567 * A285218 A059709 A344580
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, May 15 2020
STATUS
approved