A022295 Least k>1 such that first n terms of Kolakoski sequence A000002 repeat in reverse order beginning at k-th term.
4, 3, 2, 7, 16, 15, 14, 75, 74, 73, 72, 296, 295, 294, 293, 292, 291, 290, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 6253, 6252, 6251, 6250, 6249, 6248, 6247, 6246, 6245, 6244, 6243, 6242, 6241, 6240, 6239, 9379, 9378, 9377, 9376, 9375, 9374, 9373
Offset: 1
Keywords
Programs
-
Mathematica
(* Here, the condition k>1 is removed, so the 1st term is 1 instead of 4. *) n = 28; w = Prepend[Nest[Flatten[Partition[#, 2] /. {{2, 2} -> {2, 2, 1, 1}, {2, 1} -> {2, 2, 1}, {1, 2} -> {2, 1, 1}, {1, 1} -> {2, 1}}] &, {2, 2}, n], 1]; wStr = ToString[FromDigits[w]]; Map[StringPosition[wStr, StringReverse[StringTake[wStr, #]],1][[1]][[1]] &, Range[100]] (* Peter J. C. Moses, Feb 18 2021 *)