OFFSET
1,1
COMMENTS
A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
EXAMPLE
The terms together with the corresponding standard compositions begin:
133: (5,2,1)
1034: (7,2,2)
4113: (8,4,1)
8212: (9,2,3)
32802: (10,4,2)
65576: (11,2,4)
131137: (11,6,1)
262212: (12,4,3)
524368: (13,2,5)
MATHEMATICA
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Select[Range[0, 10000], Length[stc[#]]==3&&2*stc[#][[1]]==3*stc[#][[2]]+4*stc[#][[3]]&]
PROG
(Python)
from itertools import count, islice
def A357489_gen(): # generator of terms
for n in count(1):
yield from sorted((1<<n-1)+(1<<x+(y:=m//6)-1)+(1<<y-1) for x in range(1, n) if (m:=2*n-5*x)>0 and 6*(n-x)>m and m%6==0)
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Nov 02 2022
EXTENSIONS
a(10)-a(28) from Chai Wah Wu, Nov 02 2022
STATUS
approved