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

A342410 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 last run of 1's.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Apr 25 2021

Keywords

Comments

In other words, this sequence gives the last run of 1's in the binary expansion of a number.

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     1     101          1
   6     6     110        110
   7     7     111        111
   8     8    1000       1000
   9     1    1001          1
  10     2    1010         10
  11     3    1011         11
  12    12    1100       1100
  13     1    1101          1
  14    14    1110       1110
  15    15    1111       1111
		

Crossrefs

Programs

  • Mathematica
    Array[FromDigits[If[Length[s=Split@IntegerDigits[#,2]]>1,Flatten[s[[-2;;]]],First@s],2]&,100,0] (* Giorgos Kalogeropoulos, Apr 27 2021 *)
  • PARI
    a(n) = { if (n, my (z=valuation(n, 2), o=valuation(n/2^z+1, 2)); (2^o-1)*2^z, 0) }
    
  • Python
    def A342410(n):
        if n == 0 : return 0
        for i, d in enumerate(bin(n)[2:].split('0')[::-1]):
            if d != '': return int(d+'0'*i,2) # Chai Wah Wu, Apr 29 2021

Formula

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).

A361644 Irregular triangle T(n, k), n >= 0, k = 1..max(1, 2^(A005811(n)-1)), read by rows; the n-th row lists the integers with the same binary length as n and whose partial sums of run lengths are included in those of n.

Original entry on oeis.org

0, 1, 2, 3, 3, 4, 7, 4, 5, 6, 7, 6, 7, 7, 8, 15, 8, 9, 14, 15, 8, 9, 10, 11, 12, 13, 14, 15, 8, 11, 12, 15, 12, 15, 12, 13, 14, 15, 14, 15, 15, 16, 31, 16, 17, 30, 31, 16, 17, 18, 19, 28, 29, 30, 31, 16, 19, 28, 31, 16, 19, 20, 23, 24, 27, 28, 31
Offset: 0

Views

Author

Rémy Sigrist, Mar 19 2023

Keywords

Comments

In other words, the n-th row contains the numbers k with the same binary length as n and for any i >= 0, if the i-th bit and the (i+1)-th bit in k are different then they are also different in n (i = 0 corresponding to the least significant bit).
The value m appears 2^A092339(m) times in the triangle (see A361674).

Examples

			Triangle begins (in decimal and in binary):
  n   n-th row      bin(n)  n-th row in binary
  --  ------------  ------  ------------------
   0  0                  0  0
   1  1                  1  1
   2  2, 3              10  10, 11
   3  3                 11  11
   4  4, 7             100  100, 111
   5  4, 5, 6, 7       101  100, 101, 110, 111
   6  6, 7             110  110, 111
   7  7                111  111
   8  8, 15           1000  1000, 1111
   9  8, 9, 14, 15    1001  1000, 1001, 1110, 1111
.
For n = 9:
- the binary expansion of 9 is "1001",
- the corresponding run lengths are 1, 2, 1,
- so the 9th row contains the values with the following run lengths:
      1, 2, 1  ->   9 ("1001" in binary)
      1,  2+1  ->   8 ("1000" in binary)
      1+2,  1  ->  14 ("1110" in binary)
       1+2+1   ->  15 ("1111" in binary)
		

Crossrefs

Programs

  • PARI
    row(n) = { my (r = []); while (n, my (v = valuation(n+n%2, 2)); n \= 2^v; r = concat(v, r)); my (s = [if (#r, 2^r[1]-1, 0)]); for (k = 2, #r, s = concat(s * 2^r[k], [(h+1)*2^r[k]-1|h<-s]);); vecsort(s); }

Formula

T(n, 1) = A342126(n).
T(n, max(1, 2^(A005811(n)-1))) = A003817(n).

A355221 The k-th leftmost digit of a(n) is the least of the k leftmost digits of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 20, 21, 22, 22, 22, 22, 22, 22, 22, 22, 30, 31, 32, 33, 33, 33, 33, 33, 33, 33, 40, 41, 42, 43, 44, 44, 44, 44, 44, 44, 50, 51, 52, 53, 54, 55, 55, 55, 55, 55, 60, 61, 62, 63, 64, 65, 66, 66
Offset: 0

Views

Author

Rémy Sigrist, Jun 24 2022

Keywords

Comments

Leading zeros are ignored.

Examples

			For n = 1402: min({1}) = 1, min({1, 4}) = 1, min({1, 4, 0}) = 0, min({1, 4, 0, 2}) = 0, so a(1402) = 1100.
		

Crossrefs

See A355222, A355223 and A355224 for similar sequences.
Cf. A009996 (fixed points), A342126 (binary analog).

Programs

  • Mathematica
    Table[FromDigits[Table[Min[Take[IntegerDigits[n],d]],{d,IntegerLength[n]}]],{n,0,70}] (* Harvey P. Dale, Jun 30 2023 *)
  • PARI
    a(n, base=10) = { my (d=digits(n, base), m=oo); for (k=1, #d, d[k]=m=min(m, d[k])); fromdigits(d, base) }
    
  • Python
    def a(n):
        s, m = str(n), "9"
        return int("".join((m:=min(m, s[k])) for k in range(len(s))))
    print([a(n) for n in range(68)]) # Michael S. Branicky, Jun 24 2022
    
  • Python
    from itertools import accumulate
    def A355221(n): return int(''.join(accumulate(str(n),func=min))) # Chai Wah Wu, Jun 25 2022

Formula

a(n) <= n with equality iff n belongs to A009996.
a(a(n)) = a(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.
Showing 1-5 of 5 results.