A228370 Toothpick sequence from a diagram of compositions of the positive integers (see Comments lines for definition).
0, 1, 2, 4, 6, 7, 8, 11, 15, 16, 17, 19, 21, 22, 23, 27, 35, 36, 37, 39, 41, 42, 43, 46, 50, 51, 52, 54, 56, 57, 58, 63, 79, 80, 81, 83, 85, 86, 87, 90, 94, 95, 96, 98, 100, 101, 102, 106, 114, 115, 116, 118, 120, 121, 122, 125, 129, 130, 131, 133, 135, 136, 137, 143, 175
Offset: 0
Keywords
Examples
For n = 32 the diagram represents the 16 compositions of 5. The structure has 79 toothpicks, so a(32) = 79. Note that the k-th horizontal line segment has length A001511(k) equals the largest part of the k-th region, and the k-th vertical line segment has length A006519(k) equals the number of parts of the k-th region. ---------------------------------------------------------- . Triangle Compositions of compositions (rows) of 5 Diagram and regions (columns) ---------------------------------------------------------- . _ _ _ _ _ 5 _ | 5 1+4 _|_ | 1 4 2+3 _ | | 2 3 1+1+3 _|_|_ | 1 1 3 3+2 _ | | 3 2 1+2+2 _|_ | | 1 2 2 2+1+2 _ | | | 2 1 2 1+1+1+2 _|_|_|_ | 1 1 1 2 4+1 _ | | 4 1 1+3+1 _|_ | | 1 3 1 2+2+1 _ | | | 2 2 1 1+1+2+1 _|_|_ | | 1 1 2 1 3+1+1 _ | | | 3 1 1 1+2+1+1 _|_ | | | 1 2 1 1 2+1+1+1 _ | | | | 2 1 1 1 1+1+1+1+1 | | | | | 1 1 1 1 1 . Illustration of initial terms (n = 1..16): . . _ _ . _ _ _ _ _ _ _|_ . _ _ _ _ | _ | _ | . | | | | | | | | . . 1 2 4 6 7 8 . . . _ _ . _ _ _ . _ _ _ _ _ _ _ _ _ _|_ _ _|_ _ . _ _ | _ | _ | _ | . _|_ _|_ | _|_ | _|_ | _|_ | . _ | _ | | _ | | _ | | _ | | . | | | | | | | | | | | | | | . . 11 15 16 17 19 . . . _ _ _ _ _ _ _ _ . _ _ _ _ | . _ _ _ _ _|_ _|_ _|_ | . _ | _ | _ | _ | _ | | . _|_|_ _|_|_ _|_|_ _|_|_ _|_|_ | . _ | _ | _ | _ | _ | | . _|_ | _|_ | _|_ | _|_ | _|_ | | . _ | | _ | | _ | | _ | | _ | | | . | | | | | | | | | | | | | | | | . . 21 22 23 27 35 .
Links
Crossrefs
Programs
-
Python
def A228370(n): return sum(((m:=(i>>1)+1)&-m).bit_length() if i&1 else (m:=i>>1)&-m for i in range(1,n+1)) # Chai Wah Wu, Jul 14 2022
Comments