[go: up one dir, main page]

login
A049943
a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 3, 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) = 1.
4
1, 1, 3, 6, 17, 29, 63, 149, 418, 688, 1381, 2785, 5690, 11919, 25935, 61004, 171093, 281183, 562371, 1124765, 2249650, 4499839, 9001775, 18012684, 36074453, 72369085, 145581752, 294538578, 602590001, 1259536403, 2741242299, 6447482423, 18082910866, 29718339310
OFFSET
1,3
LINKS
FORMULA
From Petros Hadjicostas, Oct 26 2019: (Start)
a(n) = a(2*n - 2 - 2^ceiling(log_2(n-1))) + Sum_{i = 1..n-1} a(i) for n >= 3.
a(n) = a(1 + A006257(n-2)) + Sum_{i = 1..n-1} a(i) for n >= 3.
(End)
EXAMPLE
From Petros Hadjicostas, Oct 26 2019: (Start)
a(3) = a(1 + A006257(3-2)) + a(1) + a(2) = a(2) + a(1) + a(2) = 3;
a(4) = a(1 + A006257(4-2)) + a(1) + a(2) + a(3) = a(2) + a(1) + a(2) + a(3) = 6;
a(5) = a(1 + A006257(5-2)) + a(1) + a(2) + a(3) + a(4) = a(4) + a(1) + a(2) + a(3) + a(4) = 17. (End)
MAPLE
s := proc(n) option remember; `if`(n < 1, 0, a(n) + s(n - 1)); end proc:
a := proc(n) option remember;
`if`(n < 3, 1, s(n - 1) + a(2*n - 3 - Bits:-Iff(n - 2, n - 2)));
end proc:
seq(a(n), n = 1 .. 50); # Petros Hadjicostas, Oct 26 2019
MATHEMATICA
A006257[n_] := Boole[BitXor[n, #] < n]& /@ Range[n] // Total;
a[n_] := a[n] = If[n < 3, 1, a[1 + A006257[n-2]] + Total@Array[a, n-1]];
Table[a[n], {n, 1, 50}] (* Jean-François Alcover, Apr 24 2022 *)
CROSSREFS
Cf. A006257, A049894 (similar, but with minus a(m/2)), A049895 (similar, but with minus a(m)), A049942 (similar, but with plus a(m/2)).
Sequence in context: A369707 A327068 A307604 * A231184 A291227 A027415
KEYWORD
nonn
EXTENSIONS
More terms from Petros Hadjicostas, Oct 26 2019
STATUS
approved