This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A115517 #12 May 21 2024 16:27:53 %S A115517 0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0, %T A115517 0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0, %U A115517 0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,0,0,1,0,1,1,1,0 %N A115517 The mode of the bits of n (using 1 if bimodal). %C A115517 If n is a term of A044951, A115516(n) = a(n); otherwise, A115516(n) = 0 and a(n) = 1 (and n is a term of A031443). %H A115517 Paolo Xausa, <a href="/A115517/b115517.txt">Table of n, a(n) for n = 0..10000</a> %H A115517 Michael De Vlieger, <a href="/A115517/a115517.png">Plot a(n) at (x,y) = (n mod 1024, floor(n/1024))</a>, n = 1..1048576, with black indicating 0 and white 1. %F A115517 a(A031443(k))=1 for k>=1. %e A115517 a(5)=1 because 5 = 101 (binary) and 0 occurs once, but 1 occurs twice, so 1 is the mode. 5 is a member of A044951 (Numbers with no two equally numerous base 2 digits). %e A115517 a(10)=1 because 10 = 1010 (binary), where 0 and 1 each occur twice. As these bits are bimodal, 1 is chosen. 10 is a member of A031443 (Digitally balanced numbers: numbers which in base 2 have the same number of 0's as 1's.). %t A115517 {0}~Join~Table[If[DigitCount[n, 2, 0] > DigitCount[n, 2, 1], 0, 1], {n, 120}] (* _Harvey P. Dale_, Jul 29 2019 *) %t A115517 Array[Max[Commonest[IntegerDigits[#, 2]]] &, 100, 0] (* _Paolo Xausa_, May 21 2024 *) %o A115517 (PARI) {for(n=0,104, b=binary(n); l=length(b); s=sum(m=1,l,b[m]); if(s>=l-s, a=1, a=0); print1(a,","))} %o A115517 (Python) %o A115517 def a(n): return int(n.bit_count() >= ((n.bit_length()+1)>>1)) if n else 0 %o A115517 print([a(n) for n in range(105)]) # _Michael S. Branicky_, May 21 2024 %Y A115517 Cf. A115516 (same but use 0 if bimodal), A031443 (n's bits bimodal), A044951 (n's bits unimodal), A115353 (mode of n's decimal digits). %K A115517 base,nonn %O A115517 0,1 %A A115517 _Rick L. Shepherd_, Jan 23 2006