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.

Showing 1-1 of 1 results.

A343271 From left to right: 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).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 7, 8, 9, 10, 11, 14, 15, 15, 15, 16, 16, 18, 19, 20, 21, 23, 23, 28, 29, 31, 31, 31, 31, 31, 31, 32, 32, 32, 33, 36, 37, 38, 39, 40, 41, 42, 43, 46, 47, 47, 47, 56, 57, 58, 59, 62, 63, 63, 63, 62, 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, 64
Offset: 0

Views

Author

Rémy Sigrist, Apr 10 2021

Keywords

Comments

Leading zeros are ignored.
This sequence has similarities with A343049; here we scan the binary representations from left to right, there from right to left.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     2      10         10
   3     3      11         11
   4     4     100        100
   5     5     101        101
   6     7     110        111
   7     7     111        111
   8     8    1000       1000
   9     9    1001       1001
  10    10    1010       1010
  11    11    1011       1011
  12    14    1100       1110
  13    15    1101       1111
  14    15    1110       1111
  15    15    1111       1111
		

Crossrefs

Programs

  • PARI
    a(n, base=2) = { my (d=digits(n, base), f=vector(base), t); for (k=1, #d, f[1+d[k]]++; if (f[1+d[k]]==vecmax(f), t=d[k], d[k]=t)); fromdigits(d, base) }

Formula

A070939(a(n)) = A070939(n).
Showing 1-1 of 1 results.