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.
%I A228351 #90 Jun 22 2024 00:23:44 %S A228351 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, %T A228351 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, %U A228351 2,1,1,2,1,1,1,1,1,1,1,1,6,1,5,2,4,1,1,4 %N A228351 Triangle read by rows in which row n lists the compositions (ordered partitions) of n (see Comments lines for definition). %C A228351 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 %C A228351 Dropping the "(list-)reversed" in the comment above gives A228525. %C A228351 The equivalent sequence for partitions is A026792. %C A228351 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 %C A228351 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 %C A228351 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 %H A228351 Peter Kagey, <a href="/A228351/b228351.txt">Table of n, a(n) for n = 1..10000</a> %H A228351 Mikhail Kurkov, <a href="/A228351/a228351.txt">Comments on A228351</a> %H A228351 <a href="/index/Com#comp">Index entries for sequences that are related to compositions</a> %e A228351 Illustration of initial terms: %e A228351 ----------------------------------- %e A228351 n j Diagram Composition j %e A228351 ----------------------------------- %e A228351 . _ %e A228351 1 1 |_| 1; %e A228351 . _ _ %e A228351 2 1 |_ | 2, %e A228351 2 2 |_|_| 1, 1; %e A228351 . _ _ _ %e A228351 3 1 |_ | 3, %e A228351 3 2 |_|_ | 1, 2, %e A228351 3 3 |_ | | 2, 1, %e A228351 3 4 |_|_|_| 1, 1, 1; %e A228351 . _ _ _ _ %e A228351 4 1 |_ | 4, %e A228351 4 2 |_|_ | 1, 3, %e A228351 4 3 |_ | | 2, 2, %e A228351 4 4 |_|_|_ | 1, 1, 2, %e A228351 4 5 |_ | | 3, 1, %e A228351 4 6 |_|_ | | 1, 2, 1, %e A228351 4 7 |_ | | | 2, 1, 1, %e A228351 4 8 |_|_|_|_| 1, 1, 1, 1; %e A228351 . %e A228351 Triangle begins: %e A228351 [1]; %e A228351 [2],[1,1]; %e A228351 [3],[1,2],[2,1],[1,1,1]; %e A228351 [4],[1,3],[2,2],[1,1,2],[3,1],[1,2,1],[2,1,1],[1,1,1,1]; %e A228351 [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]; %e A228351 ... %e A228351 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 %e A228351 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 %p A228351 # Program computing the sequence: %p A228351 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 %p A228351 # Program computing the list of compositions: %p A228351 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 %t A228351 bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1]; %t A228351 Table[Differences[Prepend[bpe[n],0]],{n,0,30}] (* _Gus Wiseman_, Apr 01 2020 *) %o A228351 (Haskell) %o A228351 a228351 n = a228351_list !! (n - 1) %o A228351 a228351_list = concatMap a228351_row [1..] %o A228351 a228351_row 0 = [] %o A228351 a228351_row n = a001511 n : a228351_row (n `div` 2^(a001511 n)) %o A228351 -- _Peter Kagey_, Jun 27 2016 %o A228351 (Python) %o A228351 from itertools import count, islice %o A228351 def A228351_gen(): # generator of terms %o A228351 for n in count(1): %o A228351 k = n %o A228351 while k: %o A228351 yield (s:=(~k&k-1).bit_length()+1) %o A228351 k >>= s %o A228351 A228351_list = list(islice(A228351_gen(),30)) # _Chai Wah Wu_, Jul 17 2023 %Y A228351 Row n has length A001792(n-1). Row sums give A001787, n >= 1. %Y A228351 Cf. A000120 (binary weight), A001511, A006519, A011782, A026792, A065120. %Y A228351 A related ranking of finite sets is A048793/A272020. %Y A228351 All of the following consider the k-th row to be the k-th composition, ignoring the coarser grouping by sum. %Y A228351 - Indices of weakly increasing rows are A114994. %Y A228351 - Indices of weakly decreasing rows are A225620. %Y A228351 - Indices of strictly decreasing rows are A333255. %Y A228351 - Indices of strictly increasing rows are A333256. %Y A228351 - Indices of reversed interval rows A164894. %Y A228351 - Indices of interval rows are A246534. %Y A228351 - Indices of strict rows are A233564. %Y A228351 - Indices of constant rows are A272919. %Y A228351 - Indices of anti-run rows are A333489. %Y A228351 - Row k has A124767(k) runs and A333381(k) anti-runs. %Y A228351 - Row k has GCD A326674(k) and LCM A333226(k). %Y A228351 - Row k has Heinz number A333219(k). %Y A228351 Cf. A000120, A029931, A035327, A070939, A233249, A333217, A333218, A333220, A333227, A333627, A333628. %Y A228351 Equals A163510+1, termwise. %Y A228351 Cf. A124734 (increasing length, then lexicographic). %Y A228351 Cf. A296774 (increasing length, then reverse lexicographic). %Y A228351 Cf. A337243 (increasing length, then colexicographic). %Y A228351 Cf. A337259 (increasing length, then reverse colexicographic). %Y A228351 Cf. A296773 (decreasing length, then lexicographic). %Y A228351 Cf. A296772 (decreasing length, then reverse lexicographic). %Y A228351 Cf. A337260 (decreasing length, then colexicographic). %Y A228351 Cf. A108244 (decreasing length, then reverse colexicographic). %Y A228351 Cf. A228369 (lexicographic). %Y A228351 Cf. A066099 (reverse lexicographic). %Y A228351 Cf. A228525 (colexicographic). %K A228351 nonn,tabf %O A228351 1,2 %A A228351 _Omar E. Pol_, Aug 30 2013