OFFSET
0,6
COMMENTS
e(n) + o(n) = A000120(n), the binary weight of n.
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..10000
FORMULA
EXAMPLE
If n = 43 = 2^0+2^2+2^3+2^5, e(43)=1, o(43)=3.
MATHEMATICA
e[0] = 0; e[n_] := e[n] = e[Floor[n/4]] + If[OddQ[Mod[n, 4]], 1, 0];
o[0] = 0; o[n_] := o[n] = o[Floor[n/4]] + If[Mod[n, 4] > 1, 1, 0];
a[n_] := Max[e[n], o[n]]; Array[a, 100, 0] (* Amiram Eldar, Jul 18 2023 *)
PROG
See link in A139351 for Fortran program.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Nadia Heninger and N. J. A. Sloane, Jun 07 2008
STATUS
approved