login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A139354
Let the binary expansion of n be n = Sum_{k} 2^{r_k}, let e(n) be the number of r_k's that are even, o(n) the number that are odd; sequence gives min{e(n), o(n)}.
10
0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 2, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 0, 1, 0, 1, 1, 1, 1, 2, 0, 1, 0, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 2, 2, 3, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1
OFFSET
0,16
COMMENTS
e(n) + o(n) = A000120(n), the binary weight of n.
LINKS
FORMULA
a(n) = min(A139351(n), A139352(n)). - Amiram Eldar, Jul 18 2023
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_] := Min[e[n], o[n]]; Array[a, 100, 0] (* Amiram Eldar, Jul 18 2023 *)
PROG
(Fortran) c See link in A139351
KEYWORD
nonn,base
AUTHOR
STATUS
approved

  NODES
orte 1
see 2
Story 1