%I #22 Oct 18 2024 11:42:53
%S 1,1,1,2,1,1,2,2,1,2,1,2,2,1,2,2,1,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,1,2,
%T 2,2,2,1,2,2,1,2,2,2,2,1,2,2,2,2,2,2,1,2,2,2,2,2,1,2,2,1,2,2,1,2,2,2,
%U 2,2,2,2,2,2,1,2,2,1,2,2,1,2,2,2,2,2,2,2,2,2,1,2,2,1,2,2,2,2,2,2
%N a(1) = 1; for n > 1, a(n) = curling number of (b(1),...,b(n-1)), where b() = Thue-Morse sequence A010060 (with offset changed to 1).
%C The curling number of a finite string S = (s(1),...,s(n)) is the largest integer k such that S can be written as xy^k for strings x and y (where y has positive length).
%C From _Andrey Zabolotskiy_, Mar 03 2017: (Start)
%C The sequence consists of 1's and 2's only.
%C If 2^k>=n-1, then a(n+2^k)>=a(n).
%C The density of 1's seems to converge to 1/6.
%C (End)
%H Andrey Zabolotskiy, <a href="/A093914/b093914.txt">Table of n, a(n) for n = 1..16384</a>
%H F. J. van de Bult, D. C. Gijswijt, J. P. Linderman, N. J. A. Sloane and Allan Wilks, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL10/Sloane/sloane55.html">A Slow-Growing Sequence Defined by an Unusual Recurrence</a>, J. Integer Sequences, Vol. 10 (2007), #07.1.2.
%H F. J. van de Bult, D. C. Gijswijt, J. P. Linderman, N. J. A. Sloane and Allan Wilks, A Slow-Growing Sequence Defined by an Unusual Recurrence [<a href="http://neilsloane.com/doc/gijs.pdf">pdf</a>, <a href="http://neilsloane.com/doc/gijs.ps">ps</a>].
%H <a href="/index/Cu#curling_numbers">Index entries for sequences related to curling numbers</a>
%t (* Function curlN is defined in A094840 *)
%t (* Function ThueMorse needs Mma version >= 11 *)
%t a[n_] := If[n == 1, 1, curlN[Array[ThueMorse, n-1, 0]]];
%t Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Oct 18 2024 *)
%o (Python)
%o p, tm, s = 8, 0, 1
%o for i in range(p):
%o tm += (tm^((1<<s)-1))<<s
%o s *= 2
%o print(1)
%o for i in range(1, 1<<p):
%o a = any(((tm>>(i-j))&((1<<j)-1)) == ((tm>>(i-2*j))&((1<<j)-1)) for j in range(1, i//2+1))
%o print(2 if a else 1)
%o # _Andrey Zabolotskiy_, Mar 03 2017
%Y Cf. A090822, A094840, A010060.
%K nonn,changed
%O 1,4
%A _N. J. A. Sloane_, May 26 2004