login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A139355 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 max{e(n), o(n)}. 10

%I #13 Jul 18 2023 02:26:54

%S 0,1,1,1,1,2,1,2,1,1,2,2,1,2,2,2,1,2,1,2,2,3,2,3,1,2,2,2,2,3,2,3,1,1,

%T 2,2,1,2,2,2,2,2,3,3,2,2,3,3,1,2,2,2,2,3,2,3,2,2,3,3,2,3,3,3,1,2,1,2,

%U 2,3,2,3,1,2,2,2,2,3,2,3,2,3,2,3,3,4,3,4,2,3,2,3,3,4,3,4,1,2,2

%N 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 max{e(n), o(n)}.

%C e(n) + o(n) = A000120(n), the binary weight of n.

%H Amiram Eldar, <a href="/A139355/b139355.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = max(A139351(n), A139352(n)). - _Amiram Eldar_, Jul 18 2023

%e If n = 43 = 2^0+2^2+2^3+2^5, e(43)=1, o(43)=3.

%t e[0] = 0; e[n_] := e[n] = e[Floor[n/4]] + If[OddQ[Mod[n, 4]], 1, 0];

%t o[0] = 0; o[n_] := o[n] = o[Floor[n/4]] + If[Mod[n, 4] > 1, 1, 0];

%t a[n_] := Max[e[n], o[n]]; Array[a, 100, 0] (* _Amiram Eldar_, Jul 18 2023 *)

%o See link in A139351 for Fortran program.

%Y Cf. A000120, A139351, A139352, A139353, A139354, A039004, A139370, A139371, A139372, A139373.

%K nonn,base

%O 0,6

%A _Nadia Heninger_ and _N. J. A. Sloane_, Jun 07 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 20:26 EDT 2024. Contains 371781 sequences. (Running on oeis4.)