A228525 Triangle read by rows in which row n lists the compositions (ordered partitions) of n in colexicographic order.
1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 1, 1, 2, 2, 2, 1, 3, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 3, 1, 4, 1, 1, 1, 1, 2, 2, 1, 2, 1, 2, 2, 3, 2, 1, 1, 3, 2, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1
Offset: 1
Examples
Illustration of initial terms: --------------------------------- n j Diagram Composition --------------------------------- . _ 1 1 |_| 1; . _ _ 2 1 |_| | 1, 1, 2 2 |_ _| 2; . _ _ _ 3 1 |_| | | 1, 1, 1, 3 2 |_ _| | 2, 1, 3 3 |_| | 1, 2, 3 4 |_ _ _| 3; . _ _ _ _ 4 1 |_| | | | 1, 1, 1, 1, 4 2 |_ _| | | 2, 1, 1, 4 3 |_| | | 1, 2, 1, 4 4 |_ _ _| | 3, 1, 4 5 |_| | | 1, 1, 2, 4 6 |_ _| | 2, 2, 4 7 |_| | 1, 3, 4 8 |_ _ _ _| 4; . Triangle begins: [1]; [1,1],[2]; [1,1,1],[2,1],[1,2],[3]; [1,1,1,1],[2,1,1],[1,2,1],[3,1],[1,1,2],[2,2],[1,3],[4]; [1,1,1,1,1],[2,1,1,1],[1,2,1,1],[3,1,1],[1,1,2,1],[2,2,1],[1,3,1],[4,1],[1,1,1,2],[2,1,2],[1,2,2],[3,2],[1,1,3],[2,3],[1,4],[5];
Links
- Joerg Arndt, Table of n, a(n) for n = 1..10000
Programs
-
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
Comments