login
A050027
a(n) = a(n-1) + a(m) for n >= 4, where m = 2*n - 2 - 2^(p+1) and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = a(2) = a(3) = 1.
12
1, 1, 1, 2, 4, 5, 7, 12, 24, 25, 27, 32, 44, 69, 101, 170, 340, 341, 343, 348, 360, 385, 417, 486, 656, 997, 1345, 1730, 2216, 3213, 4943, 8156, 16312, 16313, 16315, 16320, 16332, 16357, 16389, 16458, 16628, 16969, 17317, 17702
OFFSET
1,4
LINKS
MAPLE
a := proc(n) option remember;
`if`(n < 4, [1, 1, 1][n], a(n - 1) + a(-2^ceil(log[2](n - 1)) + 2*n - 2)):
end proc:
seq(a(n), n = 1..40); # Petros Hadjicostas, Nov 18 2019
MATHEMATICA
Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 1, 1}, Flatten@Table[2 k, {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] = 1; for(n=4, nn, va[n] = va[n-1] + va[2*(n - 1 - 2^logint(n-2, 2))]); va; } \\ Petros Hadjicostas, May 10 2020
CROSSREFS
Sequence in context: A121817 A359337 A116432 * A123643 A374125 A328845
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 18 2019
STATUS
approved