login
A049884
a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 3, where m = 2*n - 3 - 2^(p+1) and p is the unique integer such that 2^p < n-1 <= 2^(p+1), with a(1) = a(2) = 1.
0
1, 1, 1, 2, 4, 8, 16, 29, 46, 107, 214, 425, 838, 1646, 3124, 5624, 8962, 21047, 42094, 84185, 168358, 336686, 673204, 1345784, 2689282, 5372726, 10712320, 21298376, 42091906, 82167734, 156312430, 281245274, 448270024, 1052852477
OFFSET
1,4
FORMULA
a(n) = -a(A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 3 with a(1) = a(2) = 1. - Petros Hadjicostas, Sep 24 2019
EXAMPLE
From Petros Hadjicostas, Sep 24 2019:
a(3) = -a(A006257(3-2)) + a(1) + a(2) = -1 + 1 + 1 = 1.
a(4) = -a(A006257(4-2)) + a(1) + a(2) + a(3) = -1 + 1 + 1 + 1 = 2.
a(5) = -a(A006257(5-2)) + a(1) + a(2) + a(3) + a(4) = -1 + 1 + 1 + 1 + 2 = 4.
a(6) = -a(A006257(6-2)) + a(1) + a(2) + a(3) + a(4) + a(5) = 8.
(End)
MAPLE
a := proc(n) local i; option remember; if n < 3 then return [1, 1][n]; end if; add(a(i), i = 1 .. n - 1) - a(2*n - 4 - Bits:-Iff(n - 2, n - 2)); end proc;
seq(a(n), n = 1 .. 37); # Petros Hadjicostas, Sep 24 2019, courtesy of Peter Luschny
CROSSREFS
Cf. A006257.
Sequence in context: A355968 A177269 A018726 * A085583 A160786 A054154
KEYWORD
nonn
EXTENSIONS
Name edited by Petros Hadjicostas, Sep 24 2019
STATUS
approved