login
A022294
a(n) is the least k>1 such that first n terms of Kolakoski sequence A000002 repeat beginning at k-th term.
5
4, 5, 7, 7, 10, 10, 10, 37, 37, 37, 37, 55, 55, 55, 55, 55, 55, 55, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 460, 15585, 15585, 15585, 15585, 15585, 15585, 15585, 15585, 15585, 15585, 15585, 15585
OFFSET
1,1
LINKS
EXAMPLE
a(3) and a(4) are both 7 because A000002 begins 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, ... and 1, 2, 2 and 1, 2, 2, 1 both repeat at position 7.
MATHEMATICA
n = 22; seq = 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]; (* A000002 *)
seq = StringJoin[Map[ToString, seq]]; Most[Flatten[Rest[Reap[NestWhile[# + 1 &, 1,
Sow[First[Last[StringPosition[seq,
StringTake[seq, #], 2]]]] > 1 &]]]]] (* Peter J. C. Moses, Jan 05 2017 *)
PROG
(C) See Links section.
CROSSREFS
KEYWORD
nonn
STATUS
approved