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-4 of 4 results.

A342126 The binary expansion of a(n) corresponds to that of n where all the 1's have been replaced by 0's except in the first run of 1's.

Original entry on oeis.org

0, 1, 2, 3, 4, 4, 6, 7, 8, 8, 8, 8, 12, 12, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 24, 24, 24, 24, 28, 28, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 56, 56, 56, 56, 60, 60, 62, 63, 64, 64, 64, 64
Offset: 0

Views

Author

Rémy Sigrist, Apr 25 2021

Keywords

Comments

In other words, this sequence gives the first run of 1's in the binary expansion of a number.
A023758(n) appears A057728(n) times.

Examples

			The first terms, alongside their binary expansion, 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     4     101        100
   6     6     110        110
   7     7     111        111
   8     8    1000       1000
   9     8    1001       1000
  10     8    1010       1000
  11     8    1011       1000
  12    12    1100       1100
  13    12    1101       1100
  14    14    1110       1110
  15    15    1111       1111
		

Crossrefs

Programs

  • PARI
    a(n) = { my (b=binary(n), p=1); for (k=1, #b, b[k] = p*=b[k]); fromdigits(b, 2) }
    
  • Python
    def A342126(n):
        s = bin(n)[2:]
        i = s.find('0')
        return n if i == -1 else (2**i-1)*2**(len(s)-i) # Chai Wah Wu, Apr 29 2021

Formula

a(n) = n - A087734(n).
a(2*n) = 2*a(n).
a(a(n)) = a(n).
a(n) <= n with equality iff n belongs to A023758.

A352724 Irregular table T(n, k) read by rows; the n-th row contains the lexicographically earlier list of A069010(n) distinct terms of A023758 summing to n.

Original entry on oeis.org

1, 2, 3, 4, 1, 4, 6, 7, 8, 1, 8, 2, 8, 3, 8, 12, 1, 12, 14, 15, 16, 1, 16, 2, 16, 3, 16, 4, 16, 1, 4, 16, 6, 16, 7, 16, 24, 1, 24, 2, 24, 3, 24, 28, 1, 28, 30, 31, 32, 1, 32, 2, 32, 3, 32, 4, 32, 1, 4, 32, 6, 32, 7, 32, 8, 32, 1, 8, 32, 2, 8, 32, 3, 8, 32
Offset: 1

Views

Author

Rémy Sigrist, Mar 30 2022

Keywords

Comments

In other words, the n-th row gives the minimal partition of n into terms of A023758 (runs of consecutive 1's in binary).

Examples

			Irregular table begins:
     1:   [1]
     2:   [2]
     3:   [3]
     4:   [4]
     5:   [1, 4]
     6:   [6]
     7:   [7]
     8:   [8]
     9:   [1, 8]
    10:   [2, 8]
    11:   [3, 8]
    12:   [12]
    13:   [1, 12]
    14:   [14]
    15:   [15]
		

Crossrefs

Cf. A023758, A069010 (row lengths), A133457, A342126, A342410.

Programs

  • PARI
    row(n) = { my (r=[], o=0); while (n, my (v=valuation(n+n%2, 2)); if (n%2, r=concat(r, (2^v-1)*2^o)); o+=v; n\=2^v); r }

Formula

Sum_{k = 1..A069010(n)} T(n, k) = n.
T(n, 1) = A342410(n).
T(n, A069010(n)) = A342126(n).

A343835 Irregular table T(n, k), n > 0, k = 1..A069010(n), read by rows; the n-th row contains the shortest partition of n whose values belong to A023758 and can be added without carriers in binary, in descending order.

Original entry on oeis.org

1, 2, 3, 4, 4, 1, 6, 7, 8, 8, 1, 8, 2, 8, 3, 12, 12, 1, 14, 15, 16, 16, 1, 16, 2, 16, 3, 16, 4, 16, 4, 1, 16, 6, 16, 7, 24, 24, 1, 24, 2, 24, 3, 28, 28, 1, 30, 31, 32, 32, 1, 32, 2, 32, 3, 32, 4, 32, 4, 1, 32, 6, 32, 7, 32, 8, 32, 8, 1, 32, 8, 2, 32, 8, 3
Offset: 1

Views

Author

Rémy Sigrist, May 01 2021

Keywords

Comments

In other words, the n-th row gives the numerical values of the runs of 1's in the binary expansion of n.

Examples

			Table begins:
     1:   [1]
     2:   [2]
     3:   [3]
     4:   [4]
     5:   [4, 1]
     6:   [6]
     7:   [7]
     8:   [8]
     9:   [8, 1]
    10:   [8, 2]
    11:   [8, 3]
    12:   [12]
    13:   [12, 1]
    14:   [14]
    15:   [15]
Table begins in binary:
       1:   [1]
      10:   [10]
      11:   [11]
     100:   [100]
     101:   [100, 1]
     110:   [110]
     111:   [111]
    1000:   [1000]
    1001:   [1000, 1]
    1010:   [1000, 10]
    1011:   [1000, 11]
    1100:   [1100]
    1101:   [1100, 1]
    1110:   [1110]
    1111:   [1111]
		

Crossrefs

Programs

  • PARI
    row(n) = { my (rr=[]); while (n, my (z=valuation(n, 2), o=valuation(n/2^z+1, 2), r=(2^o-1)*2^z); n-=r; rr = concat(r, rr);); rr }

Formula

T(n, 1) = A342126(n).
T(n, A069010(n)) = A342410(n).
Sum_{k = 1..A069010(n)} T(n, k) = n.

A343757 Irregular table read by rows; the n-th row contains the sums of distinct terms of the n-th row of table A343835, in ascending order.

Original entry on oeis.org

0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 1, 4, 5, 0, 6, 0, 7, 0, 8, 0, 1, 8, 9, 0, 2, 8, 10, 0, 3, 8, 11, 0, 12, 0, 1, 12, 13, 0, 14, 0, 15, 0, 16, 0, 1, 16, 17, 0, 2, 16, 18, 0, 3, 16, 19, 0, 4, 16, 20, 0, 1, 4, 5, 16, 17, 20, 21, 0, 6, 16, 22, 0, 7, 16, 23, 0, 24
Offset: 0

Views

Author

Rémy Sigrist, May 01 2021

Keywords

Comments

In other words, the n-th row contains the numbers k whose runs of 1's in the binary expansion also appear in that of n.
The n-th row has 2^A069010(n) terms.
This sequence has similarities with A295989.

Examples

			Table begins:
     0:    [0]
     1:    [0, 1]
     2:    [0, 2]
     3:    [0, 3]
     4:    [0, 4]
     5:    [0, 1, 4, 5]
     6:    [0, 6]
     7:    [0, 7]
     8:    [0, 8]
     9:    [0, 1, 8, 9]
    10:    [0, 2, 8, 10]
    11:    [0, 3, 8, 11]
    12:    [0, 12]
    13:    [0, 1, 12, 13]
    14:    [0, 14]
    15:    [0, 15]
Table begins in binary:
       0:   [0]
       1:   [0, 1]
      10:   [0, 10]
      11:   [0, 11]
     100:   [0, 100]
     101:   [0, 1, 100, 101]
     110:   [0, 110]
     111:   [0, 111]
    1000:   [0, 1000]
    1001:   [0, 1, 1000, 1001]
    1010:   [0, 10, 1000, 1010]
    1011:   [0, 11, 1000, 1011]
    1100:   [0, 1100]
    1101:   [0, 1, 1100, 1101]
    1110:   [0, 1110]
    1111:   [0, 1111]
		

Crossrefs

Programs

  • PARI
    row(n) = { my (rr=[]); while (n, my (z=valuation(n, 2), o=valuation(n/2^z+1, 2), r=(2^o-1)*2^z); n-=r; rr = concat(rr, r)); vector(2^#rr, k, vecsum(vecextract(rr, k-1))) }

Formula

T(n, 0) = 0.
T(n, 1) = A342410(n) for any n > 0.
T(n, 2^A069010(n)-1) = n.
Showing 1-4 of 4 results.