A228366 Toothpick sequence from a diagram of compositions of the positive integers (see Comments lines for definition).
0, 2, 6, 8, 15, 17, 21, 23, 35, 37, 41, 43, 50, 52, 56, 58, 79, 81, 85, 87, 94, 96, 100, 102, 114, 116, 120, 122, 129, 131, 135, 137, 175, 177, 181, 183, 190, 192, 196, 198, 210, 212, 216, 218, 225, 227, 231, 233, 254, 256, 260, 262, 269, 271, 275
Offset: 0
Keywords
Examples
Illustration of initial terms (n = 1..8): . _ _ _ _ . _ _ | . _ _ _|_ _|_ | . _ _ | _ | _ | | . _ _ _ _|_ _ _|_|_ _|_|_ _|_|_ | . _ _ | _ | _ | _ | _ | | . _ _ _|_ _|_ | _|_ | _|_ | _|_ | _|_ | | ._ _ | _ | _ | | _ | | _ | | _ | | _ | | | . | | | | | | | | | | | | | | | | | | | | | . .2 6 8 15 17 21 23 35 . After 16 stages there are 79 toothpicks in the structure which represents the compositions of 5 in colexicographic order as shown below: ------------------------------- n Diagram Composition ------------------------------- . _ _ _ _ _ 16 _ | 5 15 _|_ | 1+4 14 _ | | 2+3 13 _|_|_ | 1+1+3 12 _ | | 3+2 11 _|_ | | 1+2+2 10 _ | | | 2+1+2 9 _|_|_|_ | 1+1+1+2 8 _ | | 4+1 7 _|_ | | 1+3+1 6 _ | | | 2+2+1 5 _|_|_ | | 1+1+2+1 4 _ | | | 3+1+1 3 _|_ | | | 1+2+1+1 2 _ | | | | 2+1+1+1 1 | | | | | 1+1+1+1+1 .
Links
Crossrefs
Programs
-
Python
def A228366(n): return sum(((m:=(i>>1)+1)&-m).bit_length() if i&1 else (m:=i>>1)&-m for i in range(1,2*n+1)) # Chai Wah Wu, Jul 15 2022
Comments