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.

A257831 In decimal representation of n: replace each digit with its binary representation.

Original entry on oeis.org

0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 10, 11, 110, 111, 1100, 1101, 1110, 1111, 11000, 11001, 100, 101, 1010, 1011, 10100, 10101, 10110, 10111, 101000, 101001, 110, 111, 1110, 1111, 11100, 11101, 11110, 11111, 111000, 111001, 1000, 1001, 10010, 10011
Offset: 0

Views

Author

Reinhard Zumkeller, May 10 2015

Keywords

Comments

a(n) = n iff (largest digit of n) = 1: a(A007088(n)) = A007088(n);
a(n) = A007088(A080719(n)).

Examples

			.    n |  dec    -->  bin         |     a(n) |  A080719(n)
. -----+--------------------------+----------+------------
.  100 |  [1,0,0]  |  [1,0,0]     |     100  |          4
.  101 |  [1,0,1]  |  [1,0,1]     |     101  |          5
.  102 |  [1,0,2]  |  [1,0,10]    |    1010  |         10
.  103 |  [1,0,3]  |  [1,0,11]    |    1011  |         11
.  104 |  [1,0,4]  |  [1,0,100]   |   10100  |         20
.  105 |  [1,0,5]  |  [1,0,101]   |   10101  |         21
.  106 |  [1,0,6]  |  [1,0,110]   |   10110  |         22
.  107 |  [1,0,7]  |  [1,0,111]   |   10111  |         23
.  108 |  [1,0,8]  |  [1,0,1000]  |  101000  |         40
.  109 |  [1,0,9]  |  [1,0,1001]  |  101001  |         41
.  110 |  [1,1,0]  |  [1,1,0]     |     110  |          6
.  111 |  [1,1,1]  |  [1,1,1]     |     111  |          7
.  112 |  [1,1,2]  |  [1,1,10]    |    1110  |         14
.  113 |  [1,1,3]  |  [1,1,11]    |    1111  |         15
.  114 |  [1,1,4]  |  [1,1,100]   |   11100  |         28
.  115 |  [1,1,5]  |  [1,1,101]   |   11101  |         29
.  116 |  [1,1,6]  |  [1,1,110]   |   11110  |         30
.  117 |  [1,1,7]  |  [1,1,111]   |   11111  |         31
.  118 |  [1,1,8]  |  [1,1,1000]  |  111000  |         56
.  119 |  [1,1,9]  |  [1,1,1001]  |  111001  |         57
.  120 |  [1,2,0]  |  [1,10,0]    |    1100  |         12
.  121 |  [1,2,1]  |  [1,10,1]    |    1101  |         13
.  122 |  [1,2,2]  |  [1,10,10]   |   11010  |         26
.  123 |  [1,2,3]  |  [1,10,11]   |   11011  |         27
.  124 |  [1,2,4]  |  [1,10,100]  |  110100  |         52
.  125 |  [1,2,5]  |  [1,10,101]  |  110101  |         53  .
		

Crossrefs

Programs

  • Haskell
    import Data.Maybe (mapMaybe)
    a257831 = foldr (\b v -> 10 * v + b) 0 .
               concat . mapMaybe (flip lookup bin) . a031298_row
                where bin = zip [0..9] a030308_tabf
    
  • Mathematica
    Table[FromDigits[Flatten[IntegerDigits[#,2]&/@IntegerDigits[n]]],{n,0,50}] (* Harvey P. Dale, Jun 06 2020 *)
  • Python
    def A257831(n):
        return int(''.join((format(int(d),'b') for d in str(n))))
    # Chai Wah Wu, May 10 2015