login
The regular paper-folding (or dragon curve) sequence.
9

%I #38 May 26 2024 16:05:12

%S 1,1,2,1,1,2,2,1,1,1,2,2,1,2,2,1,1,1,2,1,1,2,2,2,1,1,2,2,1,2,2,1,1,1,

%T 2,1,1,2,2,1,1,1,2,2,1,2,2,2,1,1,2,1,1,2,2,2,1,1,2,2,1,2,2,1,1,1,2,1,

%U 1,2,2,1,1,1,2,2,1,2,2,1,1,1

%N The regular paper-folding (or dragon curve) sequence.

%C Over the alphabet {a,b} this is aabaabbaaabbabbaaabaabbbaabbabbaaaba...

%C With offset 1, completely multiplicative modulo 3. - _Peter Munn_, Jun 20 2022

%D J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, pp. 155, 182.

%D G. Melançon, Factorizing infinite words using Maple, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.

%H Ivan Panchenko, <a href="/A014709/b014709.txt">Table of n, a(n) for n = 0..10000</a>

%H Gabriele Fici and Luca Q. Zamboni, <a href="https://doi.org/10.1016/j.tcs.2013.02.013">On the least number of palindromes contained in an infinite word</a>, Theoretical Computer Science, Volume 481, 2013, pp. 1-8. See page 1.

%H <a href="/index/Fo#fold">Index entries for sequences obtained by enumerating foldings</a>

%F Set a=1, b=2, S(0)=a, S(n+1) = S(n)aF(S(n)), where F(x) reverses x and then interchanges a and b; sequence is limit S(infinity).

%F a(4n) = 1, a(4n+2) = 2, a(2n+1) = a(n).

%F a(n) = (3-jacobi(-1,n+1))/2 (cf. A034947). - _N. J. A. Sloane_, Jul 27 2012 [index adjusted by _Peter Munn_, Jun 22 2022]

%F a(n) = 1 + A065339(n+1) mod 2. - _Peter Munn_, Jun 20 2022

%t (3 - JacobiSymbol[-1, Range[100]])/2 (* _Paolo Xausa_, May 26 2024 *)

%o (PARI) a(n)=if(n%2==0, 1+bitand(1,n\2), a(n\2) );

%o for(n=0,122,print1(a(n),", "))

%Y See A014577 for more references and more terms.

%Y The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410. - _N. J. A. Sloane_, Jul 27 2012

%Y Cf. A065339.

%K nonn

%O 0,3

%A _N. J. A. Sloane_.