login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A228369 Triangle read by rows in which row n lists the compositions (ordered partitions) of n in lexicographic order. 35
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
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
LINKS
EXAMPLE
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];
...
MATHEMATICA
Table[Sort[Join@@Permutations/@IntegerPartitions[n], OrderedQ[PadRight[{#1, #2}]]&], {n, 5}] (* Gus Wiseman, Dec 14 2017 *)
PROG
(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
(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
(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
CROSSREFS
Sequence in context: A002635 A275806 A362833 * A296773 A108244 A277824
KEYWORD
nonn,tabf
AUTHOR
Omar E. Pol, Aug 28 2013
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 28 02:08 EDT 2024. Contains 372020 sequences. (Running on oeis4.)