OFFSET
1,2
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
LINKS
Peter Kagey, Table of n, a(n) for n = 1..10000
Mikhail Kurkov, Comments on A228351
EXAMPLE
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
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 *)
PROG
(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
(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
CROSSREFS
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 Heinz number A333219(k).
Cf. A000120, A029931, A035327, A070939, A233249, A333217, A333218, A333220, A333227, A333627, A333628.
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).
KEYWORD
nonn,tabf
AUTHOR
Omar E. Pol, Aug 30 2013
STATUS
approved