A050040 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) = 1, a(2) = 2, and a(3) = 1.
1, 2, 1, 2, 3, 4, 5, 8, 13, 14, 15, 18, 23, 36, 51, 74, 125, 126, 127, 130, 135, 148, 163, 186, 237, 362, 489, 624, 787, 1024, 1513, 2300, 3813, 3814, 3815, 3818, 3823, 3836, 3851, 3874, 3925, 4050, 4177, 4312, 4475, 4712, 5201
Offset: 1
Keywords
Links
- Ivan Neretin, Table of n, a(n) for n = 1..8193
Crossrefs
Programs
-
Maple
a := proc(n) option remember; `if`(n < 4, [1, 2, 1][n], a(n - 1) + a(-2^ceil(log[2](n - 1)) + 2*n - 3)): end proc: seq(a(n), n = 1..60); # Petros Hadjicostas, Nov 14 2019
-
Mathematica
Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 2, 1}, Flatten@Table[2 k - 1, {n, 5}, {k, 2^n}]] (* Ivan Neretin, Sep 07 2015 *)
Extensions
Name edited by Petros Hadjicostas, Nov 14 2019