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.

Previous Showing 31-40 of 64 results. Next

A337242 a(n) is the greatest number m not yet in the sequence such that the binary expansions of m and of n have the same run lengths (up to order but with multiplicity).

Original entry on oeis.org

0, 1, 2, 3, 6, 5, 4, 7, 14, 13, 10, 11, 12, 9, 8, 15, 30, 29, 26, 27, 22, 21, 20, 23, 28, 25, 18, 19, 24, 17, 16, 31, 62, 61, 58, 59, 54, 53, 52, 57, 46, 45, 42, 43, 50, 41, 40, 47, 60, 55, 44, 51, 38, 37, 36, 49, 56, 39, 34, 35, 48, 33, 32, 63, 126, 125, 122
Offset: 0

Views

Author

Rémy Sigrist, Aug 21 2020

Keywords

Comments

This sequence has similarities with A331274; here we consider run lengths in binary expansions, there binary digits.
This sequence is a self-inverse permutation of the nonnegative numbers.
This sequence preserves the number of binary digits (A070939) and the number of runs in binary expansions (A005811).
This sequence has interesting graphical features (see Links section).

Examples

			For n = 7280:
- 7280 has binary expansion "1110001110000",
- the corresponding run lengths are: {3, 3, 3, 4},
- there are four numbers k with the same multiset of run lengths:
    k     bin(k)           run lengths
    ----  ---------------  -----------
    7224  "1110000111000"  {3, 4, 3, 3}
    7280  "1110001110000"  {3, 3, 3, 4}
    7288  "1110001111000"  {3, 3, 4, 3}
    7736  "1111000111000"  {4, 3, 3, 3}
- so a(7224) = 7736,
     a(7280) = 7288,
     a(7288) = 7280,
     a(7736) = 7224.
		

Crossrefs

Programs

  • Mathematica
    Nest[Function[{a, m}, Append[a, SelectFirst[m, FreeQ[a, #] &]]] @@ {#1, Sort[Map[FromDigits[Join @@ MapIndexed[ConstantArray[Boole[OddQ@ First[#2]], #1] &, #], 2] &, Permutations[Length /@ Split@ IntegerDigits[#2, 2]]], Greater]} & @@ {#, Length@ #} &, {0}, 66] (* Michael De Vlieger, Aug 22 2020 *)
  • PARI
    See Links section.

Formula

a(2^k-1) = 2^k-1 for any k >= 0.

A341915 For any nonnegative number n with runs in binary expansion (r_1, ..., r_w), a(n) = Sum_{k = 1..w} 2^(r_1 + ... + r_k - 1).

Original entry on oeis.org

0, 1, 3, 2, 5, 7, 6, 4, 9, 13, 15, 11, 10, 14, 12, 8, 17, 25, 29, 21, 23, 31, 27, 19, 18, 26, 30, 22, 20, 28, 24, 16, 33, 49, 57, 41, 45, 61, 53, 37, 39, 55, 63, 47, 43, 59, 51, 35, 34, 50, 58, 42, 46, 62, 54, 38, 36, 52, 60, 44, 40, 56, 48, 32, 65, 97, 113
Offset: 0

Views

Author

Rémy Sigrist, Feb 23 2021

Keywords

Comments

This sequence is a permutation of the nonnegative integers with inverse A341916.
This sequence has connections with A003188; here we compute partials sums of runs from left to right, there from right to left.

Examples

			For n = 23,
- the binary representation of 23 is "10111",
- the corresponding run lengths are (1, 1, 3),
- so a(23) = 2^(1-1) + 2^(1+1-1) + 2^(1+1+3-1) = 19.
		

Crossrefs

Cf. A003188, A005811, A059893, A101211, A341916 (inverse), A341943 (fixed points).

Programs

  • Mathematica
    a[n_] := If[n == 0, 0, 2^((Length /@ Split[IntegerDigits[n, 2]] // Accumulate)-1) // Total];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 02 2022 *)
  • PARI
    a(n) = { my (v=0); while (n, my (w=valuation(n+n%2,2)); n\=2^w; v=2^w*(1+v)); v/2 }

Formula

a(n) = A059893(A003188(n)).
a(n) = Sum_{k = 1..A005811(n)} 2^((Sum_{m = 1..k} A101211(m))-1).
a(n) < 2^k for any n < 2^k.
A000120(a(n)) = A000120(A003188(n)) = A005811(n).

A361645 a(n) is the least k such that n appears in the k-th row of triangle A361644.

Original entry on oeis.org

0, 1, 2, 2, 4, 5, 5, 4, 8, 9, 10, 10, 10, 10, 9, 8, 16, 17, 18, 18, 20, 21, 21, 20, 20, 21, 21, 20, 18, 18, 17, 16, 32, 33, 34, 34, 36, 37, 37, 36, 40, 41, 42, 42, 42, 42, 41, 40, 40, 41, 42, 42, 42, 42, 41, 40, 36, 37, 37, 36, 34, 34, 33, 32, 64, 65, 66, 66
Offset: 0

Views

Author

Rémy Sigrist, Mar 19 2023

Keywords

Comments

All terms are fibbinary numbers (A003714).
To compute a(n): consider the run lengths in the binary expansion of n (i.e. the n-th row of A101211) and replace from left to right each value v > 1 at odd index with (1, v-1); at the end, there remain the run lengths in the binary expansion of a(n).
See A361676 for the greatest k's.

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

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(n) <= n with equality iff n is a fibbinary number (A003714).
a(n) <= A361676(n) with equality iff n belongs to A000975.

A361676 a(n) is the greatest k such that n appears in the k-th row of triangle A361644.

Original entry on oeis.org

0, 1, 2, 3, 5, 5, 6, 7, 11, 10, 10, 11, 13, 13, 14, 15, 23, 22, 21, 21, 21, 21, 22, 23, 27, 26, 26, 27, 29, 29, 30, 31, 47, 46, 45, 45, 43, 42, 42, 43, 43, 42, 42, 43, 45, 45, 46, 47, 55, 54, 53, 53, 53, 53, 54, 55, 59, 58, 58, 59, 61, 61, 62, 63, 95, 94, 93
Offset: 0

Views

Author

Rémy Sigrist, Mar 20 2023

Keywords

Comments

All terms belong to A003754.
To compute a(n): consider the run lengths in the binary expansion of n (i.e. the n-th row of A101211) and replace from left to right each value v > 1 at even index with (1, v-1); at the end, there remain the run lengths in the binary expansion of a(n).
See A361645 for the least k's.

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

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(n) >= n with equality iff n belongs to A003754.
a(n) >= A361645(n) with equality iff n belongs to A000975.

A382255 Heinz number of the partition corresponding to run lengths in the bits of n.

Original entry on oeis.org

1, 2, 4, 3, 6, 8, 6, 5, 10, 12, 16, 12, 9, 12, 10, 7, 14, 20, 24, 18, 24, 32, 24, 20, 15, 18, 24, 18, 15, 20, 14, 11, 22, 28, 40, 30, 36, 48, 36, 30, 40, 48, 64, 48, 36, 48, 40, 28, 21, 30, 36, 27, 36, 48, 36, 30, 25, 30, 40, 30, 21, 28, 22, 13, 26, 44, 56, 42
Offset: 0

Views

Author

M. F. Hasler and Ali Sada, Mar 19 2025

Keywords

Comments

The run lengths (number of consecutive bits that are equal) in the binary numbers in [2^(L-1), 2^L-1], i.e., of bit length L, yield all possible compositions of L, i.e., the partitions with any possible order of the parts.
Associated to any composition (p1, ..., pK) is their Heinz number prime(p1)*...*prime(pK) which depends only on the partition, i.e., not on the order of the parts.
The sequence can also be read as a table with row lengths 1, 1, 2, 4, 8, 16, 32, ... (= A011782), where row L = 0, 1, 2, 3, ... lists the 2^(L-1) compositions of L through their Heinz numbers (which will appear more than once if they contain at least two distinct parts).

Examples

			   n | binary | partition | a(n) = Heinz number
  ---+--------+-----------+--------------------
   0 |   (0)  | empty sum | 1 = empty product
   1 |     1  |     1     | 2 = prime(1)
   2 |    10  |    1+1    | 4 = prime(1) * prime(1)
   3 |    11  |     2     | 3 = prime(2)
   4 |   100  |    1+2    | 6 = prime(1) * prime(2)
   5 |   101  |   1+1+1   | 8 = 2^3 = prime(1) * prime(1) * prime(1)
   6 |   110  |    2+1    | 6 = prime(2) * prime(1)
   7 |   111  |     3     | 5 = prime(3)
   8 |  1000  |    1+3    | 10 = 2*5 = prime(1) * prime(3)
   9 |  1001  |   1+2+1   | 12 = 2^2*3 = prime(1) * prime(2) * prime(1)
  ...|   ...  |    ...    | ...
For example, n = 4 = 100[2] (in binary) has run lengths (1, 2), namely: one bit 1 followed by two bits 0. This gives a(4) = prime(1)*prime(2) = 6.
Next, n = 5 = 101[2] (in binary) has run lengths (1, 1, 1): one bit 1, followed by one bit 0, followed by one bit 1. This gives a(4) = prime(1)^3 = 8.
Then, n = 6 = 110[2] (in binary) has run lengths (2, 1): first two bits 1, then one bit 0. This is the same as for 4, just in reverse order, so it yields the same Heinz number a(6) = prime(2)*prime(1) = 6.
Then, n = 7 = 111[2] (in binary) has run lengths (3), namely: three bits 1. This gives a(5) = prime(3) = 5.
Sequence written as irregular triangle:
   1;
   2;
   4,  3;
   6,  8,  6,  5;
  10, 12, 16, 12,  9, 12, 10,  7;
  14, 20, 24, 18, 24, 32, 24, 20, 15, 18, 24, 18, 15, 20, 14, 11;
  ...
		

Crossrefs

Cf. A112798 and A296150 (partitions sorted by Heinz number).
Cf. A185974, A334433, A334435, A334438, A334434, A129129, A334436 (partitions given as Heinz numbers, in Abramowitz-Stegun, Maple, Mathematica order).
For "constructive" lists of partitions see A036036 (Abramowitz and Stegun order), A036036 (reversed), A080576 (Maple order), A080577 (Mathematica order).
Row sums of triangle give A030017(n+1).
Cf. A007088 (the binary numbers).
Cf. A101211 (the run lengths as rows of a table).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<2, 1+n, (p->
          a(iquo(n, 2^p))*ithprime(p))(padic[ordp](n+(n mod 2), 2)))
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Mar 20 2025
  • PARI
    Heinz(p)=vecprod([ prime(k) | k <- p ])
    RL(v) = if(#v, v=Vec(select(t->t,concat([1,v[^1]-v[^-1],1]),1)); v[^1]-v[^-1])
    apply( {A382255(n) = Heinz(RL(binary(n)))}, [0..99] )

Formula

a(2^n) = A001747(n+1).
a(2^n-1) = A008578(n+1).
a(2^n+1) = A001749(n-1) for n>=2.

A175911 Concatenate the run lengths of the runs of ones and zeros in the binary representation of n in the lowest possible base where it is possible to represent each run length as a single digit. Convert the result to base 10.

Original entry on oeis.org

1, 3, 2, 5, 7, 7, 3, 7, 16, 15, 14, 8, 22, 13, 4, 9, 29, 49, 17, 41, 31, 43, 23, 11, 25, 67, 23, 14, 53, 21, 5, 11, 46, 117, 30, 50, 148, 52, 27, 87, 124, 63, 122, 44, 130, 93, 34, 14, 45, 76, 26, 68, 202, 70, 39, 15, 57, 213, 54, 22, 106, 31, 6, 13, 67, 231, 47, 118, 469, 121
Offset: 1

Views

Author

Dylan Hamilton, Oct 14 2010

Keywords

Crossrefs

Programs

  • Haskell
    a175911 n = foldl1 (\v d -> b * v + d) rls where
       b = maximum rls + 1
       rls = a101211_row n
    -- Reinhard Zumkeller, Dec 16 2013
  • Mathematica
    repcount[x_] := Length/@Split[x]
    binrep[x_] := repcount[IntegerDigits[x, 2]]
    Table[h = binrep[x]; FromDigits[h, Max[h] + 1], {x, 1, DESIRED_NUMBER_OF_DIGITS}]
    f[n_] := Block[{a = Length /@ Split@ IntegerDigits[n, 2]}, FromDigits[a, Max@ a + 1]]; Array[f, 70] (* Robert G. Wilson v, Aug 17 2013 *)

A335834 Sort the run lengths in binary expansion of n in ascending order (with multiplicities).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 4, 7, 8, 11, 10, 11, 12, 11, 8, 15, 16, 23, 20, 19, 20, 21, 20, 23, 24, 19, 20, 19, 24, 23, 16, 31, 32, 47, 40, 39, 44, 43, 44, 39, 40, 43, 42, 43, 44, 43, 40, 47, 48, 39, 44, 51, 44, 43, 44, 39, 56, 39, 40, 39, 48, 47, 32, 63, 64, 95, 80, 79
Offset: 0

Views

Author

Rémy Sigrist, Jun 26 2020

Keywords

Comments

This sequence preserves the number of runs (A005811) and the length (A070939) of the binary representation of a number.

Examples

			For n = 72:
- the binary representation of 72 is "1001000",
- the corresponding run lengths are: 1, 2, 1, 3,
- in ascending order: 1, 1, 2, 3,
- so the binary representation of a(72) is "1011000",
- and a(72) = 88.
		

Crossrefs

Cf. A005811, A037014 (fixed points), A070939, A101211, A335835.

Programs

  • Mathematica
    Array[FromDigits[Flatten@ MapIndexed[ConstantArray[Mod[First[#2], 2], #1] &, Sort[Length /@ Split[IntegerDigits[#, 2]]]], 2] &, 67] (* Michael De Vlieger, Jun 27 2020 *)
  • PARI
    torl(n) = { my (rr=[]); while (n, my (r=valuation(n+(n%2), 2)); rr = concat(r, rr); n\=2^r); rr }
    fromrl(rr) = { my (v=0); for (k=1, #rr, v = (v+(k%2))*2^rr[k]-(k%2)); v }
    a(n) = { fromrl(vecsort(torl(n))) }

Formula

a(a(n)) = a(n).

A335967 Irregular table read by rows; if the binary representation of n encodes the last row of a tiling of a staircase polyomino, then the n-th row contains the numbers k whose binary representation encode possible penultimate rows.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Sep 14 2020

Keywords

Comments

We consider tilings of staircase polyominoes as described in A335547, and encode rows of such tilings as described in A336479.

Examples

			Triangle begins:
     1: [0]
     2: [1]
     3: [1]
     4: [2]
     5: [2, 3]
     6: [2]
     7: [3]
     8: [4]
     9: [5]
    10: [4, 5, 6, 7]
    11: [5, 6]
    12: [5]
    13: [4, 5]
    ...
For n = 13, the binary representation of 13 is "1101", so we consider the tilings of a size 4 staircase polyomino whose base has the following shape:
      .....
      .   .
      .   .....
      .       .
      +---+   .....
      |   |       .
      |   +---+---+---+
      | 1   1 | 0 | 1 |
      +-------+---+---+
There are two possible penultimate rows:
      .....              .....
      .   .              .   .
      .   .....          .   .....
      .   |   .          .       .
      +---+   +---+      +---+---+---+
      | 1 | 0   0 |      | 1 | 0 | 1 |
      |   +---+---+---+  |   +---+---+---+
      |       |   |   |  |       |   |   |
      +-------+---+---+, +-------+---+---+
so the 13th row contains 4 and 5 ("100" and "101" in binary).
		

Crossrefs

Cf. A101211, A335547, A336479, A337131 (row lengths).

Programs

  • PARI
    See Links section.

Formula

A336479(n) = Sum_{k = 1..A337131(n)} A336479(T(n, k)).

A336479 For any number n with k binary digits, a(n) is the number of tilings T of a size k staircase polyomino (as described in A335547) such that the sizes of the polyominoes at the base of T correspond to the lengths of runs of consecutive equal digits in the binary representation of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 5, 3, 2, 3, 1, 1, 1, 2, 8, 5, 11, 18, 8, 5, 3, 5, 11, 7, 3, 5, 1, 1, 1, 2, 13, 8, 26, 42, 18, 11, 26, 42, 94, 58, 29, 47, 13, 8, 5, 8, 29, 18, 36, 58, 26, 16, 7, 11, 26, 16, 5, 8, 1, 1, 1, 2, 21, 13, 60, 97, 42, 26, 87, 141, 317
Offset: 0

Views

Author

Rémy Sigrist, Sep 13 2020

Keywords

Comments

a(0) = 1 corresponds to the empty polyomino.

Examples

			For n = 13, the binary representation of 13 is "1101", so we count the tilings of a size 4 staircase polyomino whose base has the following shape:
      .....
      .   .
      .   .....
      .       .
      +---+   .....
      |   |       .
      |   +---+---+---+
      | 1   1 | 0 | 1 |
      +-------+---+---+
there are 3 such tilings:
      +---+              +---+              +---+
      |   |              |   |              |   |
      +---+---+          +   +---+          +---+---+
      |   |   |          |       |          |   |   |
      +---+---+---+      +---+---+---+      +---+   +---+
      |   |   |   |      |   |   |   |      |   |       |
      |   +---+---+---+  |   +---+---+---+  |   +---+---+---+
      |       |   |   |  |       |   |   |  |       |   |   |
      +-------+---+---+, +-------+---+---+, +-------+---+---+
so a(13) = 3.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

A335547(n) = Sum_{k = 2^(n-1)..2^n-1} a(k).
a(A000975(n+1)) = A335547(n).
a(2^k-1) = 1 for any k >= 0.
a(2^k) = 1 for any k >= 0.
a(3*2^k) = A000045(k+1) for any k >= 0.
a(7*2^k) = A123392(k) for any k >= 0.

A341839 Square array T(n, k), n, k >= 0, read by antidiagonals; for any number m with runs in binary expansion (r_1, ..., r_j), let R(m) = {r_1 + ... + r_j, r_2 + ... + r_j, ..., r_j}; T(n, k) is the unique number t such that R(t) is the union of R(n) and of R(k).

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 3, 2, 2, 3, 4, 2, 2, 2, 4, 5, 5, 2, 2, 5, 5, 6, 5, 5, 3, 5, 5, 6, 7, 6, 5, 4, 4, 5, 6, 7, 8, 6, 5, 5, 4, 5, 5, 6, 8, 9, 9, 5, 5, 5, 5, 5, 5, 9, 9, 10, 9, 10, 4, 5, 5, 5, 4, 10, 9, 10, 11, 10, 10, 11, 4, 5, 5, 4, 11, 10, 10, 11, 12, 10, 10, 10, 11, 5, 6, 5, 11, 10, 10, 10, 12
Offset: 0

Views

Author

Rémy Sigrist, Feb 21 2021

Keywords

Comments

For any m > 0, R(m) contains the partial sums of the m-th row of A227736; by convention, R(0) = {}.
The underlying idea is to break in an optimal way the runs in binary expansions of n and of k so that they match, hence the relationship with A003188.

Examples

			Array T(n, k) begins:
  n\k|    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
  ---+-----------------------------------------------------------------
    0|    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
    1|    1   1   2   2   5   5   6   6   9   9  10  10  13  13  14  14
    2|    2   2   2   2   5   5   5   5  10  10  10  10  13  13  13  13
    3|    3   2   2   3   4   5   5   4  11  10  10  11  12  13  13  12
    4|    4   5   5   4   4   5   5   4  11  10  10  11  11  10  10  11
    5|    5   5   5   5   5   5   5   5  10  10  10  10  10  10  10  10
    6|    6   6   5   5   5   5   6   6   9   9  10  10  10  10   9   9
    7|    7   6   5   4   4   5   6   7   8   9  10  11  11  10   9   8
    8|    8   9  10  11  11  10   9   8   8   9  10  11  11  10   9   8
    9|    9   9  10  10  10  10   9   9   9   9  10  10  10  10   9   9
   10|   10  10  10  10  10  10  10  10  10  10  10  10  10  10  10  10
   11|   11  10  10  11  11  10  10  11  11  10  10  11  11  10  10  11
   12|   12  13  13  12  11  10  10  11  11  10  10  11  12  13  13  12
   13|   13  13  13  13  10  10  10  10  10  10  10  10  13  13  13  13
   14|   14  14  13  13  10  10   9   9   9   9  10  10  13  13  14  14
   15|   15  14  13  12  11  10   9   8   8   9  10  11  12  13  14  15
		

Crossrefs

Programs

  • PARI
    T(n,k) = { my (r=[], v=0); while (n||k, my (w=min(valuation(n+n%2,2), valuation(k+k%2,2))); r=concat(w,r); n\=2^w; k\=2^w); for (k=1, #r, v=(v+k%2)*2^r[k]-k%2); v }

Formula

T(n, k) = T(k, n)
T(m, T(n, k)) = T(T(m, n), k).
T(n, n) = n.
T(n, 0) = 0.
A070939(T(n, k)) = max(A070939(n), A070939(k)).
A003188(T(n, k)) = A003188(n) OR A003188(k) (where OR denotes the bitwise OR operator).
T(n, 1) = A042963(ceiling((n+1)/2)).
Previous Showing 31-40 of 64 results. Next