cp's OEIS Frontend

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.

A343049 The k-th binary digit of a(n) is the most frequent digit among the first k binary digits of n (in case of a tie, take the k-th binary digit of n).

This page as a plain text file.
%I A343049 #12 Apr 10 2021 10:35:25
%S A343049 0,1,2,7,0,5,6,31,0,9,10,31,8,29,30,127,0,1,2,23,0,21,22,127,0,25,26,
%T A343049 127,24,125,126,511,0,1,2,39,0,37,38,127,0,41,42,127,40,125,126,511,0,
%U A343049 33,34,119,32,117,118,511,32,121,122,511,120,509,510,2047,0
%N A343049 The k-th binary digit of a(n) is the most frequent digit among the first k binary digits of n (in case of a tie, take the k-th binary digit of n).
%C A343049 Leading zeros are taken into account up to the point the number of zeros exceeds the total number of ones.
%C A343049 We scan the binary representation of a number starting from the least significant digit. See A343271 for the other way.
%H A343049 Rémy Sigrist, <a href="/A343049/b343049.txt">Table of n, a(n) for n = 0..8192</a>
%H A343049 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A343049 a(n) = 0 iff n belongs to A036993.
%F A343049 a(n) = n iff n = 0 or n belongs to A032925.
%F A343049 a(2^k-1) = 2^(2*k-1)-1 for any k > 1.
%F A343049 A070939(a(n)) < 2*A070939(n).
%e A343049 The first terms, in decimal and in binary, are:
%e A343049   n   a(n)  bin(n)  bin(a(n))
%e A343049   --  ----  ------  ---------
%e A343049    0     0       0          0
%e A343049    1     1       1          1
%e A343049    2     2      10         10
%e A343049    3     7      11        111
%e A343049    4     0     100          0
%e A343049    5     5     101        101
%e A343049    6     6     110        110
%e A343049    7    31     111      11111
%e A343049    8     0    1000          0
%e A343049    9     9    1001       1001
%e A343049   10    10    1010       1010
%e A343049   11    31    1011      11111
%e A343049   12     8    1100       1000
%e A343049   13    29    1101      11101
%e A343049   14    30    1110      11110
%e A343049   15   127    1111    1111111
%o A343049 (PARI) a(n, base=2) = { my (d=digits(n, base), t, f=vector(base)); d=concat(vector(#d), d); forstep (k=#d, 1, -1, f[1+d[k]]++; if (vecmax(f)==f[1+d[k]], t=d[k];); d[k]=t); fromdigits(d, base) }
%Y A343049 Cf. A032925, A036993, A070939, A343271, A342697.
%K A343049 nonn,base
%O A343049 0,3
%A A343049 _Rémy Sigrist_, Apr 09 2021