login
A152724
In binary, count of most frequent bit of n.
2
1, 1, 2, 2, 2, 2, 3, 3, 2, 2, 3, 2, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 4, 3, 4, 4, 5, 5, 4, 4, 3, 4, 3, 3, 4, 4, 3, 3, 4, 3, 4, 4, 5, 4, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 6, 5, 5, 4, 5, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 5, 5, 4, 4, 4, 4, 4, 4, 5
OFFSET
1,3
COMMENTS
Express n in binary, then a(n) is the larger of the number of 0's and the number of 1's.
FORMULA
a(n) = max( A000120(n), A023416(n) ).
a(n) + A152723(n) = 1 + floor(log_2(n)).
a(n) = A070939(n) - A152723(n). - Reinhard Zumkeller, Mar 31 2015
EXAMPLE
a(17) = 3 because 17 in binary is 10001, which has three 0's and two 1's.
MATHEMATICA
a[n_] := Max @@ DigitCount[n, 2]; Array[a, 100] (* Amiram Eldar, Jul 29 2023 *)
PROG
(Haskell)
a152724 n = max (a000120 n) (a023416 n)
-- Reinhard Zumkeller, Mar 31 2015
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Frank Ruskey, Dec 11 2008
STATUS
approved