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-10 of 31 results. Next

A228720 Number of partitions in the first n compositions of j, according with the ordering of A228525, if 1<=n<=2^(j-1).

Original entry on oeis.org

1, 2, 2, 3, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15
Offset: 1

Views

Author

Omar E. Pol, Aug 30 2013

Keywords

Comments

For a program, see A228525.

Examples

			For n = 13 there are only six partitions in the first 13 rows of the list of compositions of any integer >= 5, so a(13) = 6.
---------------------------------------------------------
.               |          Compositions of j
.               |
n  a(n) A228354 | 1    2     3       4         5
---------------------------------------------------------
.
1   1  *   1      1    1+1   1+1+1   1+1+1+1   1+1+1+1+1
2   2  *   2           2     2+1     2+1+1     2+1+1+1
3   2                        1+2     1+2+1     1+2+1+1
4   3  *   4                 3       3+1       3+1+1
5   3                                1+1+2     1+1+2+1
6   4  *   6                         2+2       2+2+1
7   4                                1+3       1+3+1
8   5  *   8                         4         4+1
9   5                                          1+1+1+2
10  5                                          2+1+2
11  5                                          1+2+2
12  6  *  12                                   3+2
13  6                                          1+1+3
14  6                                          2+3
15  6                                          1+4
16  7  *  16                                   5
...
		

Crossrefs

Where records occur here are in A228354.

Formula

a(2^(n-1)) = A000041(n), n >= 1.

A066099 Triangle read by rows, in which row n lists the compositions of n in reverse lexicographic order.

Original entry on oeis.org

1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 1, 2, 2, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 5, 4, 1, 3, 2, 3, 1, 1, 2, 3, 2, 2, 1, 2, 1, 2, 2, 1, 1, 1, 1, 4, 1, 3, 1, 1, 2, 2, 1, 2, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 6, 5, 1, 4, 2, 4, 1, 1, 3, 3, 3, 2, 1, 3, 1, 2, 3, 1, 1, 1, 2, 4, 2, 3
Offset: 1

Views

Author

Alford Arnold, Dec 30 2001

Keywords

Comments

The representation of the compositions (for fixed n) is as lists of parts, the order between individual compositions (for the same n) is (list-)reversed lexicographic; see the example by Omar E. Pol. - Joerg Arndt, Sep 03 2013
This is the standard ordering for compositions in this database; it is similar to the Mathematica ordering for partitions (A080577). Other composition orderings include A124734 (similar to the Abramowitz & Stegun ordering for partitions, A036036), A108244 (similar to the Maple partition ordering, A080576), etc (see crossrefs).
Factorize each term in A057335; sequence records the values of the resulting exponents. It also runs through all possible permutations of multiset digits.
This can be regarded as a table in two ways: with each composition as a row, or with the compositions of each integer as a row. The first way has A000120 as row lengths and A070939 as row sums; the second has A001792 as row lengths and A001788 as row sums. - Franklin T. Adams-Watters, Nov 06 2006
This sequence includes every finite sequence of positive integers. - Franklin T. Adams-Watters, Nov 06 2006
Compositions (or ordered partitions) are also generated in sequence A101211. - Alford Arnold, Dec 12 2006
The equivalent sequence for partitions is A228531. - Omar E. Pol, Sep 03 2013
The sole partition of zero has no components, not a single component of length one. Hence the first nonempty row is row 1. - Franklin T. Adams-Watters, Apr 02 2014 [Edited by Andrey Zabolotskiy, May 19 2018]
See sequence A261300 for another version where the terms of each composition are concatenated to form one single integer: (0, 1, 2, 11, 3, 21, 12, 111,...). This also shows how the terms can be obtained from the binary numbers A007088, cf. Arnold's first Example. - M. F. Hasler, Aug 29 2015
The k-th composition in the list is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This is described as the standard ordering used in the OEIS, although the sister sequence A228351 is also sometimes considered to be canonical. Both sequences define a bijective correspondence between nonnegative integers and integer compositions. - Gus Wiseman, May 19 2020
First differences of A030303 = positions of bits 1 in the concatenation A030190 (= A030302) of numbers written in binary (A007088). - Indices of record values (= first occurrence of n) are given by A005183: a(A005183(n)) = n, cf. FORMULA for more. - M. F. Hasler, Oct 12 2020
The geometric mean approaches the Somos constant (A112302). - Jwalin Bhatt, Feb 10 2025

Examples

			A057335 begins 1 2 4 6 8 12 18 30 16 24 36 ... so we can write
  1 2 1 3 2 1 1 4 3 2 2 1 1 1 1 ...
  . . 1 . 1 2 1 . 1 2 1 3 2 1 1 ...
  . . . . . . 1 . . . 1 . 1 2 1 ...
  . . . . . . . . . . . . . . 1 ...
and the columns here gives the rows of the triangle, which begins
  1
  2; 1 1
  3; 2 1; 1 2; 1 1 1
  4; 3 1; 2 2; 2 1 1; 1 3; 1 2 1; 1 1 2; 1 1 1 1
  ...
From _Omar E. Pol_, Sep 03 2013: (Start)
Illustration of initial terms:
  -----------------------------------
  n  j       Diagram   Composition j
  -----------------------------------
  .               _
  1  1           |_|   1;
  .             _ _
  2  1         |  _|   2,
  2  2         |_|_|   1, 1;
  .           _ _ _
  3  1       |    _|   3,
  3  2       |  _|_|   2, 1,
  3  3       | |  _|   1, 2,
  3  4       |_|_|_|   1, 1, 1;
  .         _ _ _ _
  4  1     |      _|   4,
  4  2     |    _|_|   3, 1,
  4  3     |   |  _|   2, 2,
  4  4     |  _|_|_|   2, 1, 1,
  4  5     | |    _|   1, 3,
  4  6     | |  _|_|   1, 2, 1,
  4  7     | | |  _|   1, 1, 2,
  4  8     |_|_|_|_|   1, 1, 1, 1;
(End)
		

Crossrefs

Lists of compositions of integers: this sequence (reverse lexicographic order; minus one gives A108730), A228351 (reverse colexicographic order - every composition is reversed; minus one gives A163510), A228369 (lexicographic), A228525 (colexicographic), A124734 (length, then lexicographic; minus one gives A124735), A296774 (length, then reverse lexicographic), A337243 (length, then colexicographic), A337259 (length, then reverse colexicographic), A296773 (decreasing length, then lexicographic), A296772 (decreasing length, then reverse lexicographic), A337260 (decreasing length, then colexicographic), A108244 (decreasing length, then reverse colexicographic), also A101211 and A227736 (run lengths of bits).
Cf. row length and row sums for different splittings into rows: A000120, A070939, A001792, A001788.
Cf. lists of partitions of integers, or multisets of integers: A026791 and crosserfs therein, A112798 and crossrefs therein.
See link for additional crossrefs pertaining to standard compositions.
A related ranking of finite sets is A048793/A272020.

Programs

  • Haskell
    a066099 = (!!) a066099_list
    a066099_list = concat a066099_tabf
    a066099_tabf = map a066099_row [1..]
    a066099_row n = reverse $ a228351_row n
    -- (each composition as a row)
    -- Peter Kagey, Aug 25 2016
    
  • Mathematica
    Table[FactorInteger[Apply[Times, Map[Prime, Accumulate @ IntegerDigits[n, 2]]]][[All, -1]], {n, 41}] // Flatten (* Michael De Vlieger, Jul 11 2017 *)
    stc[n_] := Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]] // Reverse;
    Table[stc[n], {n, 0, 20}] // Flatten (* Gus Wiseman, May 19 2020 *)
    Table[Reverse @ LexicographicSort @ Flatten[Permutations /@ Partitions[n], 1], {n, 10}] // Flatten (* Eric W. Weisstein, Jun 26 2023 *)
  • PARI
    arow(n) = {local(v=vector(n),j=0,k=0);
       while(n>0,k++; if(n%2==1,v[j++]=k;k=0);n\=2);
       vector(j,i,v[j-i+1])} \\ returns empty for n=0. - Franklin T. Adams-Watters, Apr 02 2014
    
  • Python
    from itertools import islice
    from itertools import accumulate, count, groupby, islice
    def A066099_gen():
        for i in count(1):
            yield [len(list(g)) for _,g in groupby(accumulate(int(b) for b in bin(i)[2:]))]
    A066099 = list(islice(A066099_gen(), 120))  # Jwalin Bhatt, Feb 28 2025
  • Sage
    def a_row(n): return list(reversed(Compositions(n)))
    flatten([a_row(n) for n in range(1,6)]) # Peter Luschny, May 19 2018
    

Formula

From M. F. Hasler, Oct 12 2020: (Start)
a(n) = A030303(n+1) - A030303(n).
a(A005183(n)) = n; a(A005183(n)+1) = n-1 (n>1); a(A005183(n)+2) = 1. (End)

Extensions

Edited with additional terms by Franklin T. Adams-Watters, Nov 06 2006
0th row removed by Andrey Zabolotskiy, May 19 2018

A228351 Triangle read by rows in which row n lists the compositions (ordered partitions) of n (see Comments lines for definition).

Original entry on oeis.org

1, 2, 1, 1, 3, 1, 2, 2, 1, 1, 1, 1, 4, 1, 3, 2, 2, 1, 1, 2, 3, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 5, 1, 4, 2, 3, 1, 1, 3, 3, 2, 1, 2, 2, 2, 1, 2, 1, 1, 1, 2, 4, 1, 1, 3, 1, 2, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, 5, 2, 4, 1, 1, 4
Offset: 1

Views

Author

Omar E. Pol, Aug 30 2013

Keywords

Comments

The representation of the compositions (for fixed n) is as lists of parts, the order between individual compositions (for the same n) is (list-)reversed co-lexicographic. - Joerg Arndt, Sep 02 2013
Dropping the "(list-)reversed" in the comment above gives A228525.
The equivalent sequence for partitions is A026792.
This sequence lists (without repetitions) all finite compositions, in such a way that, if [P_1, ..., P_r] denotes the composition occupying the n-th position in the list, then (((2*n/2^(P_1)-1)/2^(P_2)-1)/...)/2^(P_r)-1 = 0. - Lorenzo Sauras Altuzarra, Jan 22 2020
The k-th composition in the list is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, and taking first differences. Reversing again gives A066099, which is described as the standard ordering. Both sequences define a bijective correspondence between nonnegative integers and integer compositions. - Gus Wiseman, Apr 01 2020
It follows from the previous comment that A000120(k) is the length of the k-th composition that is listed by this sequence (recall that A000120(k) is the number of 1's in the binary expansion of k). - Lorenzo Sauras Altuzarra, Sep 29 2020

Examples

			Illustration of initial terms:
-----------------------------------
n  j     Diagram     Composition j
-----------------------------------
.         _
1  1     |_|         1;
.         _ _
2  1     |_  |       2,
2  2     |_|_|       1, 1;
.         _ _ _
3  1     |_    |     3,
3  2     |_|_  |     1, 2,
3  3     |_  | |     2, 1,
3  4     |_|_|_|     1, 1, 1;
.         _ _ _ _
4  1     |_      |   4,
4  2     |_|_    |   1, 3,
4  3     |_  |   |   2, 2,
4  4     |_|_|_  |   1, 1, 2,
4  5     |_    | |   3, 1,
4  6     |_|_  | |   1, 2, 1,
4  7     |_  | | |   2, 1, 1,
4  8     |_|_|_|_|   1, 1, 1, 1;
.
Triangle begins:
[1];
[2],[1,1];
[3],[1,2],[2,1],[1,1,1];
[4],[1,3],[2,2],[1,1,2],[3,1],[1,2,1],[2,1,1],[1,1,1,1];
[5],[1,4],[2,3],[1,1,3],[3,2],[1,2,2],[2,1,2],[1,1,1,2],[4,1],[1,3,1],[2,2,1],[1,1,2,1],[3,1,1],[1,2,1,1],[2,1,1,1],[1,1,1,1,1];
...
For example [1,2] occupies the 5th position in the corresponding list of compositions and indeed (2*5/2^1-1)/2^2-1 = 0. - _Lorenzo Sauras Altuzarra_, Jan 22 2020
12 --binary expansion--> [1,1,0,0] --reverse--> [0,0,1,1] --positions of 1's--> [3,4] --prepend 0--> [0,3,4] --first differences--> [3,1]. - _Lorenzo Sauras Altuzarra_, Sep 29 2020
		

Crossrefs

Row n has length A001792(n-1). Row sums give A001787, n >= 1.
Cf. A000120 (binary weight), A001511, A006519, A011782, A026792, A065120.
A related ranking of finite sets is A048793/A272020.
All of the following consider the k-th row to be the k-th composition, ignoring the coarser grouping by sum.
- Indices of weakly increasing rows are A114994.
- Indices of weakly decreasing rows are A225620.
- Indices of strictly decreasing rows are A333255.
- Indices of strictly increasing rows are A333256.
- Indices of reversed interval rows A164894.
- Indices of interval rows are A246534.
- Indices of strict rows are A233564.
- Indices of constant rows are A272919.
- Indices of anti-run rows are A333489.
- Row k has A124767(k) runs and A333381(k) anti-runs.
- Row k has GCD A326674(k) and LCM A333226(k).
- Row k has Heinz number A333219(k).
Equals A163510+1, termwise.
Cf. A124734 (increasing length, then lexicographic).
Cf. A296774 (increasing length, then reverse lexicographic).
Cf. A337243 (increasing length, then colexicographic).
Cf. A337259 (increasing length, then reverse colexicographic).
Cf. A296773 (decreasing length, then lexicographic).
Cf. A296772 (decreasing length, then reverse lexicographic).
Cf. A337260 (decreasing length, then colexicographic).
Cf. A108244 (decreasing length, then reverse colexicographic).
Cf. A228369 (lexicographic).
Cf. A066099 (reverse lexicographic).
Cf. A228525 (colexicographic).

Programs

  • Haskell
    a228351 n = a228351_list !! (n - 1)
    a228351_list = concatMap a228351_row [1..]
    a228351_row 0 = []
    a228351_row n = a001511 n : a228351_row (n `div` 2^(a001511 n))
    -- Peter Kagey, Jun 27 2016
    
  • Maple
    # Program computing the sequence:
    A228351 := proc(n) local c, k, L, N: L, N := [], [seq(2*r, r = 1 .. n)]: for k in N do c := 0: while k != 0 do if gcd(k, 2) = 2 then k := k/2: c := c+1: else L := [op(L), op(c)]: k := k-1: c := 0: fi: od: od: L[n]: end: # Lorenzo Sauras Altuzarra, Jan 22 2020
    # Program computing the list of compositions:
    List := proc(n) local c, k, L, M, N: L, M, N := [], [], [seq(2*r, r = 1 .. 2^n-1)]: for k in N do c := 0: while k != 0 do if gcd(k, 2) = 2 then k := k/2: c := c+1: else L := [op(L), c]: k := k-1: c := 0: fi: od: M := [op(M), L]: L := []: od: M: end: # Lorenzo Sauras Altuzarra, Jan 22 2020
  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Differences[Prepend[bpe[n],0]],{n,0,30}] (* Gus Wiseman, Apr 01 2020 *)
  • Python
    from itertools import count, islice
    def A228351_gen(): # generator of terms
        for n in count(1):
            k = n
            while k:
                yield (s:=(~k&k-1).bit_length()+1)
                k >>= s
    A228351_list = list(islice(A228351_gen(),30)) # Chai Wah Wu, Jul 17 2023

A211992 Triangle read by rows in which row n lists the partitions of n in colexicographic order.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 2, 1, 1, 3, 1, 2, 2, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 2, 2, 1, 4, 1, 3, 2, 5, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 3, 2, 1, 5, 1, 2, 2, 2, 4, 2, 3, 3, 6, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 2, 1, 1, 1, 4, 1, 1, 1, 3, 2, 1, 1, 5, 1, 1, 2, 2, 2, 1, 4, 2, 1, 3, 3, 1, 6, 1, 3, 2, 2, 5, 2, 4, 3, 7
Offset: 1

Views

Author

Omar E. Pol, Aug 18 2012

Keywords

Comments

The order of the partitions of every integer is reversed with respect to A026792. For example: in A026792 the partitions of 3 are listed as [3], [2, 1], [1, 1, 1], however here the partitions of 3 are listed as [1, 1, 1], [2, 1], [3].
Row n has length A006128(n). Row sums give A066186. Right border gives A000027. The equivalent sequence for compositions (ordered partitions) is A228525. - Omar E. Pol, Aug 24 2013
The representation of the partitions (for fixed n) is as (weakly) decreasing lists of parts, the order between individual partitions (for the same n) is co-lexicographic. The equivalent sequence for partitions as (weakly) increasing lists and lexicographic order is A026791. - Joerg Arndt, Sep 02 2013

Examples

			From _Omar E. Pol_, Aug 24 2013: (Start)
Illustration of initial terms:
-----------------------------------------
n      Diagram          Partition
-----------------------------------------
.       _
1      |_|              1;
.       _ _
2      |_| |            1, 1,
2      |_ _|            2;
.       _ _ _
3      |_| | |          1, 1, 1,
3      |_ _| |          2, 1,
3      |_ _ _|          3;
.       _ _ _ _
4      |_| | | |        1, 1, 1, 1,
4      |_ _| | |        2, 1, 1,
4      |_ _ _| |        3, 1,
4      |_ _|   |        2, 2,
4      |_ _ _ _|        4;
.       _ _ _ _ _
5      |_| | | | |      1, 1, 1, 1, 1,
5      |_ _| | | |      2, 1, 1, 1,
5      |_ _ _| | |      3, 1, 1,
5      |_ _|   | |      2, 2, 1,
5      |_ _ _ _| |      4, 1,
5      |_ _ _|   |      3, 2,
5      |_ _ _ _ _|      5;
.       _ _ _ _ _ _
6      |_| | | | | |    1, 1, 1, 1, 1, 1,
6      |_ _| | | | |    2, 1, 1, 1, 1,
6      |_ _ _| | | |    3, 1, 1, 1,
6      |_ _|   | | |    2, 2, 1, 1,
6      |_ _ _ _| | |    4, 1, 1,
6      |_ _ _|   | |    3, 2, 1,
6      |_ _ _ _ _| |    5, 1,
6      |_ _|   |   |    2, 2, 2,
6      |_ _ _ _|   |    4, 2,
6      |_ _ _|     |    3, 3,
6      |_ _ _ _ _ _|    6;
...
Triangle begins:
[1];
[1,1], [2];
[1,1,1], [2,1], [3];
[1,1,1,1], [2,1,1], [3,1], [2,2], [4];
[1,1,1,1,1], [2,1,1,1], [3,1,1], [2,2,1], [4,1], [3,2], [5];
[1,1,1,1,1,1], [2,1,1,1,1], [3,1,1,1], [2,2,1,1], [4,1,1], [3,2,1], [5,1], [2,2,2], [4,2], [3,3], [6];
(End)
From _Gus Wiseman_, May 10 2020: (Start)
The triangle with partitions shown as Heinz numbers (A334437) begins:
    1
    2
    4   3
    8   6   5
   16  12  10   9   7
   32  24  20  18  14  15  11
   64  48  40  36  28  30  22  27  21  25  13
  128  96  80  72  56  60  44  54  42  50  26  45  33  35  17
(End)
		

Crossrefs

The graded reversed version is A026792.
The length-sensitive refinement is A036037.
The version for reversed partitions is A080576.
Partition lengths are A193173.
Partition maxima are A194546.
Partition minima are A196931.
The version for compositions is A228525.
The Heinz numbers of these partitions are A334437.

Programs

  • Mathematica
    colex[f_,c_]:=OrderedQ[PadRight[{Reverse[f],Reverse[c]}]];
    Join@@Table[Sort[IntegerPartitions[n],colex],{n,0,6}] (* Gus Wiseman, May 10 2020 *)
  • PARI
    gen_part(n)=
    {  /* Generate partitions of n as weakly increasing lists (order is lex): */
        my(ct = 0);
        my(m, pt);
        my(x, y);
        \\ init:
        my( a = vector( n + (n<=1) ) );
        a[1] = 0;  a[2] = n;  m = 2;
        while ( m!=1,
            y = a[m] - 1;
            m -= 1;
            x = a[m] + 1;
            while ( x<=y,
                a[m] = x;
                y = y - x;
                m += 1;
            );
            a[m] = x + y;
            pt = vector(m, j, a[j]);
        /* for A026791 print partition: */
    \\        for (j=1, m, print1(pt[j],", ") );
        /* for A211992 print partition as weakly decreasing list (order is colex): */
            forstep (j=m, 1, -1, print1(pt[j],", ") );
            ct += 1;
        );
        return(ct);
    }
    for(n=1, 10, gen_part(n) );
    \\ Joerg Arndt, Sep 02 2013

A228369 Triangle read by rows in which row n lists the compositions (ordered partitions) of n in lexicographic order.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 2, 1, 1, 2, 2, 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 2, 1, 3, 1, 1, 4, 2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 3, 3, 1, 1, 3, 2, 4, 1, 5, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Omar E. Pol, Aug 28 2013

Keywords

Comments

The representation of the compositions (for fixed n) is as lists of parts, the order between individual compositions (for the same n) is lexicographic. - Joerg Arndt, Sep 02 2013
The equivalent sequence for partitions is A026791.
Row n has length A001792(n-1).
Row sums give A001787, n >= 1.
The m-th composition has length A008687(m+1), m >= 1. - Andrey Zabolotskiy, Jul 19 2017

Examples

			Illustration of initial terms:
-----------------------------------
n  j       Diagram   Composition j
-----------------------------------
.               _
1  1           |_|   1;
.             _ _
2  1         | |_|   1, 1,
2  2         |_ _|   2;
.           _ _ _
3  1       | | |_|   1, 1, 1,
3  2       | |_ _|   1, 2,
3  3       |   |_|   2, 1,
3  4       |_ _ _|   3;
.         _ _ _ _
4  1     | | | |_|   1, 1, 1, 1,
4  2     | | |_ _|   1, 1, 2,
4  3     | |   |_|   1, 2, 1,
4  4     | |_ _ _|   1, 3,
4  5     |   | |_|   2, 1, 1,
4  6     |   |_ _|   2, 2,
4  7     |     |_|   3, 1,
4  8     |_ _ _ _|   4;
.
Triangle begins:
[1];
[1,1],[2];
[1,1,1],[1,2],[2,1],[3];
[1,1,1,1],[1,1,2],[1,2,1],[1,3],[2,1,1],[2,2],[3,1],[4];
[1,1,1,1,1],[1,1,1,2],[1,1,2,1],[1,1,3],[1,2,1,1],[1,2,2],[1,3,1],[1,4],[2,1,1,1],[2,1,2],[2,2,1],[2,3],[3,1,1],[3,2],[4,1],[5];
...
		

Crossrefs

Programs

  • Haskell
    a228369 n = a228369_list !! (n - 1)
    a228369_list = concatMap a228369_row [1..]
    a228369_row 0 = []
    a228369_row n
      | 2^k == 2 * n + 2 = [k - 1]
      | otherwise        = a228369_row (n `div` 2^k) ++ [k] where
        k = a007814 (n + 1) + 1
    -- Peter Kagey, Jun 27 2016
    
  • Mathematica
    Table[Sort[Join@@Permutations/@IntegerPartitions[n],OrderedQ[PadRight[{#1,#2}]]&],{n,5}] (* Gus Wiseman, Dec 14 2017 *)
  • PARI
    gen_comp(n)=
    {  /* Generate compositions of n as lists of parts (order is lex): */
        my(ct = 0);
        my(m, z, pt);
        \\ init:
        my( a = vector(n, j, 1) );
        m = n;
        while ( 1,
            ct += 1;
            pt = vector(m, j, a[j]);
            /* for A228369  print composition: */
            for (j=1, m, print1(pt[j],", ") );
    \\        /* for A228525 print reversed (order is colex): */
    \\        forstep (j=m, 1, -1, print1(pt[j],", ") );
            if ( m<=1,  return(ct) );  \\ current is last
            a[m-1] += 1;
            z = a[m] - 2;
            a[m] = 1;
            m += z;
        );
        return(ct);
    }
    for(n=1, 12, gen_comp(n) );
    \\ Joerg Arndt, Sep 02 2013
    
  • Python
    a = [[[]], [[1]]]
    for s in range(2, 9):
        a.append([])
        for k in range(1, s+1):
            for ss in a[s-k]:
                a[-1].append([k]+ss)
    print(a)
    # Andrey Zabolotskiy, Jul 19 2017

A080576 Triangle in which n-th row lists all partitions of n, in graded reflected lexicographic order.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 3, 2, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, 3, 1, 2, 3, 3, 3, 1, 1, 4, 2, 4, 1, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 2, 2
Offset: 1

Views

Author

N. J. A. Sloane, Mar 23 2003

Keywords

Comments

The graded reflected lexicographic ordering of the partitions is used by Maple. - Daniel Forgues, Jan 19 2011
Each partition here is the conjugate of the corresponding partition in Abramowitz and Stegun order (A036036). The partitions are in the reverse of the order of the partitions in Mathematica order (A080577). - Franklin T. Adams-Watters, Oct 18 2006
Reversing all partitions gives A193073 (the non-reflected version). The version for reversed (weakly increasing) partitions is A211992. Reversed partitions in Abramowitz-Stegun order (sum/length/lex) are A036036. - Gus Wiseman, May 20 2020
Also reversed integer partitions in colexicographic order, cf. A228531. - Gus Wiseman, May 31 2020

Examples

			First five rows are:
[[1]]
[[1, 1], [2]]
[[1, 1, 1], [1, 2], [3]]
[[1, 1, 1, 1], [1, 1, 2], [2, 2], [1, 3], [4]]
[[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 2, 2], [1, 1, 3], [2, 3], [1, 4], [5]]
From _Gus Wiseman_, May 20 2020: (Start)
The sequence of all reversed partitions begins:
  ()       (122)     (15)       (25)
  (1)      (113)     (6)        (16)
  (11)     (23)      (1111111)  (7)
  (2)      (14)      (111112)   (11111111)
  (111)    (5)       (11122)    (1111112)
  (12)     (111111)  (1222)     (111122)
  (3)      (11112)   (11113)    (11222)
  (1111)   (1122)    (1123)     (2222)
  (112)    (222)     (223)      (111113)
  (22)     (1113)    (133)      (11123)
  (13)     (123)     (1114)     (1223)
  (4)      (33)      (124)      (1133)
  (11111)  (114)     (34)       (233)
  (1112)   (24)      (115)      (11114)
(End)
		

Crossrefs

See A080577 for the Mathematica (graded reverse lexicographic) ordering.
See A036036 for the Hindenburg (graded reflected colexicographic) ordering (listed in the Abramowitz and Stegun Handbook).
See A036037 for the graded colexicographic ordering.
See A193073 for the graded lexicographic ordering. - M. F. Hasler, Jul 16 2011
See A228100 for the Fenner-Loizou (binary tree) ordering.
Row n has A000041(n) partitions.
Taking colexicographic instead of lexicographic gives A026791.
Lengths of these partitions appear to be A049085.
Reversing all partitions gives A193073 (the non-reflected version).
The version for reversed (weakly increasing) partitions is A211992.
The generalization to compositions is A228525.
The Heinz numbers of these partitions are A334434.

Programs

  • Maple
    with(combinat); partition(6);
  • Mathematica
    row[n_] := Flatten[Reverse /@ Reverse[SplitBy[Reverse /@ IntegerPartitions[n], Length]], 1]; Array[row, 7] // Flatten (* Jean-François Alcover, Dec 05 2016 *)
    lexsort[f_,c_]:=OrderedQ[PadRight[{f,c}]];
    Reverse/@Join@@Table[Sort[IntegerPartitions[n],lexsort],{n,0,8}] (* Gus Wiseman, May 20 2020 *)

Extensions

Edited by Daniel Forgues, Jan 21 2011

A228366 Toothpick sequence from a diagram of compositions of the positive integers (see Comments lines for definition).

Original entry on oeis.org

0, 2, 6, 8, 15, 17, 21, 23, 35, 37, 41, 43, 50, 52, 56, 58, 79, 81, 85, 87, 94, 96, 100, 102, 114, 116, 120, 122, 129, 131, 135, 137, 175, 177, 181, 183, 190, 192, 196, 198, 210, 212, 216, 218, 225, 227, 231, 233, 254, 256, 260, 262, 269, 271, 275
Offset: 0

Views

Author

Omar E. Pol, Aug 22 2013

Keywords

Comments

In order to construct this sequence we use the following rules:
We start in the first quadrant of the square grid with no toothpicks, so a(0) = 0.
At stage n we place the smallest possible number of toothpicks of length 1 connected by their endpoints in horizontal direction starting from the grid point (0, n) such that the x-coordinate of the exposed endpoint of the last toothpick is not equal to the x-coordinate of any outer corner of the structure. Then we place toothpicks of length 1 connected by their endpoints in vertical direction, starting from the exposed toothpick endpoint, downward up to touch the structure or up to touch the x-axis.
The sequence gives the number of toothpicks after n stages. A228367 (the first differences) gives the number of toothpicks added at the n-th stage.
Note that the number of toothpick of added at n-th stage in horizontal direction is also A001511(n) and the number of toothpicks added at n-th stage in vertical direction is also A006519(n). Also counting both the x-axis and the y-axis we have that A001511(n) is also the largest part of the n-th region of the diagram and A006519(n) is also the number of parts of the n-th region of the diagram.
After 2^k stages a new section of the structure is completed, so the structure can be interpreted as a diagram of the 2^(k-1) compositions of k in colexicographic order, if k >= 1 (see A228525). The infinite diagram can be interpreted as a table of compositions of the positive integers.

Examples

			Illustration of initial terms (n = 1..8):
.                                                _ _ _ _
.                                        _       _      |
.                                _ _     _|_     _|_    |
.                        _       _  |    _  |    _  |   |
.                _ _ _   _|_ _   _|_|_   _|_|_   _|_|_  |
.          _     _    |  _    |  _    |  _    |  _    | |
.    _ _   _|_   _|_  |  _|_  |  _|_  |  _|_  |  _|_  | |
._   _  |  _  |  _  | |  _  | |  _  | |  _  | |  _  | | |
. |   | |   | |   | | |   | | |   | | |   | | |   | | | |
.
.2    6     8      15      17      21      23       35
.
After 16 stages there are 79 toothpicks in the structure which represents the compositions of 5 in colexicographic order as shown below:
-------------------------------
n     Diagram      Composition
-------------------------------
.     _ _ _ _ _
16    _        |   5
15    _|_      |   1+4
14    _  |     |   2+3
13    _|_|_    |   1+1+3
12    _    |   |   3+2
11    _|_  |   |   1+2+2
10    _  | |   |   2+1+2
9     _|_|_|_  |   1+1+1+2
8     _      | |   4+1
7     _|_    | |   1+3+1
6     _  |   | |   2+2+1
5     _|_|_  | |   1+1+2+1
4     _    | | |   3+1+1
3     _|_  | | |   1+2+1+1
2     _  | | | |   2+1+1+1
1      | | | | |   1+1+1+1+1
.
		

Crossrefs

Programs

  • Python
    def A228366(n): return sum(((m:=(i>>1)+1)&-m).bit_length() if i&1 else (m:=i>>1)&-m for i in range(1,2*n+1)) # Chai Wah Wu, Jul 15 2022

Formula

a(n) = sum_{k=1..n} (A001511(k) + A006519(k)), n >= 1.
a(n) = A005187(n) + A065120(n-1), n >= 1.
a(n) = A228370(2n).

A228370 Toothpick sequence from a diagram of compositions of the positive integers (see Comments lines for definition).

Original entry on oeis.org

0, 1, 2, 4, 6, 7, 8, 11, 15, 16, 17, 19, 21, 22, 23, 27, 35, 36, 37, 39, 41, 42, 43, 46, 50, 51, 52, 54, 56, 57, 58, 63, 79, 80, 81, 83, 85, 86, 87, 90, 94, 95, 96, 98, 100, 101, 102, 106, 114, 115, 116, 118, 120, 121, 122, 125, 129, 130, 131, 133, 135, 136, 137, 143, 175
Offset: 0

Views

Author

Omar E. Pol, Aug 21 2013

Keywords

Comments

In order to construct this sequence we use the following rules:
We start in the first quadrant of the square grid with no toothpicks, so a(0) = 0.
If n is odd then at stage n we place the smallest possible number of toothpicks of length 1 connected by their endpoints in horizontal direction starting from the grid point (0, (n+1)/2) such that the x-coordinate of the exposed endpoint of the last toothpick is not equal to the x-coordinate of any outer corner of the structure.
If n is even then at stage n we place toothpicks of length 1 connected by their endpoints in vertical direction, starting from the exposed toothpick endpoint, downward up to touch the structure or up to touch the x-axis.
Note that the number of toothpick of added at stage (n+1)/2 in horizontal direction is also A001511(n) and the number of toothpicks added at stage n/2 in vertical direction is also A006519(n).
The sequence gives the number of toothpicks after n stages. A228371 (the first differences) gives the number of toothpicks added at the n-th stage.
After 2^k stages a new section of the structure is completed, so the structure can be interpreted as a diagram of the 2^(k-1) compositions of k in colexicographic order, if k >= 1 (see A228525). The infinite diagram can be interpreted as a table of compositions of the positive integers.
The equivalent sequence for partitions is A225600.

Examples

			For n = 32 the diagram represents the 16 compositions of 5. The structure has 79 toothpicks, so a(32) = 79. Note that the k-th horizontal line segment has length A001511(k) equals the largest part of the k-th region, and the k-th vertical line segment has length A006519(k) equals the number of parts of the k-th region.
----------------------------------------------------------
.                                    Triangle
Compositions                  of compositions (rows)
of 5          Diagram          and regions (columns)
----------------------------------------------------------
.            _ _ _ _ _
5            _        |                                 5
1+4          _|_      |                               1 4
2+3          _  |     |                             2   3
1+1+3        _|_|_    |                           1 1   3
3+2          _    |   |                         3       2
1+2+2        _|_  |   |                       1 2       2
2+1+2        _  | |   |                     2   1       2
1+1+1+2      _|_|_|_  |                   1 1   1       2
4+1          _      | |                 4               1
1+3+1        _|_    | |               1 3               1
2+2+1        _  |   | |             2   2               1
1+1+2+1      _|_|_  | |           1 1   2               1
3+1+1        _    | | |         3       1               1
1+2+1+1      _|_  | | |       1 2       1               1
2+1+1+1      _  | | | |     2   1       1               1
1+1+1+1+1     | | | | |   1 1   1       1               1
.
Illustration of initial terms (n = 1..16):
.
.                                   _        _
.                   _ _    _ _      _ _      _|_
.       _     _     _      _  |     _  |     _  |
.              |     |      | |      | |      | |
.
.       1      2     4      6        7        8
.
.
.                                            _ _
.                        _         _         _
.     _ _ _    _ _ _     _ _ _     _|_ _     _|_ _
.     _        _    |    _    |    _    |    _    |
.     _|_      _|_  |    _|_  |    _|_  |    _|_  |
.     _  |     _  | |    _  | |    _  | |    _  | |
.      | |      | | |     | | |     | | |     | | |
.
.       11       15        16        17        19
.
.
.                                _ _ _ _    _ _ _ _
.             _        _         _          _      |
.    _ _      _ _      _|_       _|_        _|_    |
.    _  |     _  |     _  |      _  |       _  |   |
.    _|_|_    _|_|_    _|_|_     _|_|_      _|_|_  |
.    _    |   _    |   _    |    _    |     _    | |
.    _|_  |   _|_  |   _|_  |    _|_  |     _|_  | |
.    _  | |   _  | |   _  | |    _  | |     _  | | |
.     | | |    | | |    | | |     | | |      | | | |
.
.      21       22       23        27          35
.
		

Crossrefs

Programs

  • Python
    def A228370(n): return sum(((m:=(i>>1)+1)&-m).bit_length() if i&1 else (m:=i>>1)&-m for i in range(1,n+1)) # Chai Wah Wu, Jul 14 2022

Formula

a(n) = sum_{k=1..n} A228371(k), n >= 1.
a(2n-1) = A005187(n) + A006520(n+1) - A006519(n), n >= 1.
a(2n) = A005187(n) + A006520(n+1), n >= 1.

A182105 Number of elements merged by bottom-up merge sort.

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 16, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 16, 32, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8, 16, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 1, 1, 2, 4, 8
Offset: 1

Views

Author

Dhruv Matani, Apr 12 2012

Keywords

Comments

Also triangle read by rows in which row j lists the first A001511(j) powers of 2, j >= 1, hence records give A000079. Right border gives A006519. Row sums give A038712. The equivalent sequence for partitions is A211009. See example. - Omar E. Pol, Sep 03 2013
It appears that A045412 gives the indices of the terms which are greater than 1. - Carl Joshua Quines, Apr 07 2017

Examples

			Using construction (b), the initial values n, u_n, v_n are:
  1, 1, 1
  2, 2, 1
  3, 2, 2
  4, 3, 1
  5, 4, 1
  6, 4, 2
  7, 4, 4
  8, 5, 1
  9, 6, 1
  10, 6, 2
  11, 7, 1
  12, 8, 1
  13, 8, 2
  14, 8, 4
  15, 8, 8
  16, 9, 1
  17, 10, 1
  18, 10, 2
  19, 11, 1
  20, 12, 1
  ...
From _Omar E. Pol_, Sep 03 2013: (Start)
Illustration of initial terms (first 2^5-1 terms):
Written as an irregular triangle: T(j,k) is also the length of the k-th column in the j-th region of the diagram, as shown below. Note that the j-th row of the diagram is equivalent to the j-th composition (in colexicographic order) of 5 (cf. A228525):
------------------------------------
.          Diagram      Triangle
------------------------------------
.  j / k: 1 2 3 4 5  /  1 2 3 4 5
------------------------------------
.         _ _ _ _ _
.  1     |_| | | | |    1;
.  2     |_ _| | | |    1,2;
.  3     |_|   | | |    1;
.  4     |_ _ _| | |    1,2,4;
.  5     |_| |   | |    1;
.  6     |_ _|   | |    1,2;
.  7     |_|     | |    1;
.  8     |_ _ _ _| |    1,2,4,8;
.  9     |_| | |   |    1;
. 10     |_ _| |   |    1,2;
. 11     |_|   |   |    1;
. 12     |_ _ _|   |    1,2,4;
. 13     |_| |     |    1;
. 14     |_ _|     |    1,2;
. 15     |_|       |    1;
. 16     |_ _ _ _ _|    1,2,4,8,16;
...
(End)
		

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4, Pre-Fascicle 6A, Section 7.2.2.2, Eq. (97).
  • Donald E. Knuth, The Art of Computer Programming, Addison-Wesley (2015) Vol. 4, Fascicle 6, Satisfiability, p. 80, Eq. (130).

Crossrefs

Cf. A046699, A215020 (a version involving Fibonacci numbers).

Programs

Formula

The following two constructions are given by Knuth:
(a) a(1) = 1; thereafter a(n+1) = 2a(n) if a(n) has already occurred an even number of times, otherwise a(n+1) = 1.
(b) Set (u_1, v_1) = (1, 1), thereafter (u_{n+1}, v_{n+1}) = ( A ? B : C)
where
A = u_n & -u_n = v_n (where the AND refers to the binary expansions),
B = (u_n + 1, 1) (the result if A is true),
C = (u_n, 2v_n) (the result if A is false).
Then v_n = A182105, u_n = A046699 minus first term.
a(n) = 2^(A082850(n)-1). - Laurent Orseau, Jun 18 2019

Extensions

Edited by N. J. A. Sloane, Aug 02 2012

A228354 Indices (k) of partitions in the list of compositions of j in colexicographic order, if 1<=k<=2^(j-1), j>=1.

Original entry on oeis.org

1, 2, 4, 6, 8, 12, 16, 22, 24, 28, 32, 44, 48, 56, 64, 86, 88, 92, 96, 112, 120, 128, 172, 176, 184, 192, 220, 224, 240, 256, 342, 344, 348, 352, 368, 376, 384, 440, 448, 480, 496, 512, 684, 688, 696, 704, 732, 736, 752, 768, 880, 888, 896, 960, 992, 1024
Offset: 1

Views

Author

Omar E. Pol, Aug 20 2013

Keywords

Comments

Also where records occur in A228720.
Also triangle read by rows in which row j lists the indices of the partitions of j into parts greater than the smallest part of the partitions of j-1, in the list of compositions of j in colexicographic order. See A228525 and A211992.
The total number of terms in the first j rows of triangle is A000041(j), j >= 1.
Row j has length A187219(j).
Right border gives A000079.

Examples

			For j = 5 consider the list of compositions of 5 in colexicographic order (see A228525). The indices of the partitions are 1, 2, 4, 6, 8, 12, 16 which are the first A000041(5) terms of this sequence, see below:
---------------------------------------------------------
.   Compositions                     Partitions
k      of 5                             of 5      n  a(n)
---------------------------------------------------------
1    1+1+1+1+1  * ............... *  1+1+1+1+1    1    1
2    2+1+1+1    * ............... *  2+1+1+1      2    2
3    1+2+1+1          ........... *  3+1+1        3    4
4    3+1+1      * .../ .......... *  2+2+1        4    6
5    1+1+2+1          / ......... *  4+1          5    8
6    2+2+1      * .../ /   ...... *  3+2          6   12
7    1+3+1            /   /   ... *  5            7   16
8    4+1        * .../   /   /
9    1+1+1+2            /   /
10   2+1+2             /   /
11   1+2+2            /   /
12   3+2        * .../   /
13   1+1+3              /
14   2+3               /
15   1+4              /
16   5          * .../
.
Written as an irregular triangle the sequence begins:
1;
2;
4;
6,8;
12,16;
22,24,28,32;
44,48,56,64;
86,88,92,96,112,120,128;
172,176,184,192,220,224,240,256;
342,344,348,352,368,376,384,440,448,480,496,512;
684,688,696,704,732,736,752,768,880,888,896,960,992,1024;
...
		

Crossrefs

Formula

a(n) = 1 + A194602(n-1).
A001511(a(n)) = A141285(n).
A000120(a(n)-1) = A207034(n).
Showing 1-10 of 31 results. Next