A228351 Triangle read by rows in which row n lists the compositions (ordered partitions) of n (see Comments lines for definition).
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
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
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
- Mikhail Kurkov, Comments on A228351
- Index entries for sequences that are related to compositions
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).
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
Comments