A050046 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) = 1 and a(2) = a(3) = 2.
1, 2, 2, 3, 5, 6, 8, 10, 13, 14, 16, 18, 21, 26, 32, 40, 50, 51, 53, 55, 58, 63, 69, 77, 87, 100, 114, 130, 148, 169, 195, 227, 267, 268, 270, 272, 275, 280, 286, 294, 304, 317, 331, 347, 365, 386, 412, 444
Offset: 1
Keywords
Links
- Ivan Neretin, Table of n, a(n) for n = 1..8193
Crossrefs
Cf. similar sequences listed in A050034.
Programs
-
Maple
a := proc(n) option remember; `if`(n < 4, [1, 2, 2][n], a(n - 1) + a(-2^ceil(-1+log[2](n - 1)) + n - 1)): end proc: seq(a(n), n = 1..40); # Petros Hadjicostas, Apr 23 2020
-
Mathematica
Fold[Append[#1, #1[[-1]] + #1[[#2]]] &, {1, 2, 2}, Flatten@Table[k, {n, 5}, {k, 2^n}]] (* Ivan Neretin, Sep 08 2015 *)
Extensions
Name edited by Petros Hadjicostas, Apr 23 2020