OFFSET
1,1
COMMENTS
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.
Every sequence can be uniquely split into a sequence of non-overlapping runs. For example, the runs of (2,2,1,1,1,3,2,2) are ((2,2),(1,1,1),(3),(2,2)), with sums (4,3,3,4).
The first term k such that the k-th composition in standard order does not have ones sandwiching the same prime number an even number of times is k = 3221, corresponding to the composition (1,3,3,2,2,1).
EXAMPLE
The terms and their corresponding compositions begin:
3: (1,1)
7: (1,1,1)
11: (2,1,1)
14: (1,1,2)
15: (1,1,1,1)
19: (3,1,1)
23: (2,1,1,1)
27: (1,2,1,1)
28: (1,1,3)
29: (1,1,2,1)
30: (1,1,1,2)
31: (1,1,1,1,1)
MATHEMATICA
stc[n_]:=Differences[Prepend[Join@@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Select[Range[0, 100], FreeQ[Total/@Split[#]&/@ Join@@Permutations/@IntegerPartitions[Total[stc[#]]], stc[#]]&]
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jun 21 2022
STATUS
approved