OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..3316
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
KEYWORD
nonn
AUTHOR
EXTENSIONS
More terms from Petros Hadjicostas, Oct 26 2019
STATUS
approved