cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A014710 The regular paper-folding (or dragon curve) sequence. Alphabet {2,1}.

This page as a plain text file.
%I A014710 #48 Jul 08 2025 05:41:32
%S A014710 2,2,1,2,2,1,1,2,2,2,1,1,2,1,1,2,2,2,1,2,2,1,1,1,2,2,1,1,2,1,1,2,2,2,
%T A014710 1,2,2,1,1,2,2,2,1,1,2,1,1,1,2,2,1,2,2,1,1,1,2,2,1,1,2,1,1,2,2,2,1,2,
%U A014710 2,1,1,2,2,2,1,1,2,1,1,2,2,2
%N A014710 The regular paper-folding (or dragon curve) sequence. Alphabet {2,1}.
%H A014710 Ivan Panchenko, <a href="/A014710/b014710.txt">Table of n, a(n) for n = 0..10000</a>
%H A014710 G. Melançon, <a href="https://www.researchgate.net/publication/322200645_MapleTech_Volume_4_no_1_Spring_1997">Factorizing infinite words using Maple</a>, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.
%H A014710 <a href="/index/Fo#fold">Index entries for sequences obtained by enumerating foldings</a>
%F A014710 Set a=2, b=1, 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 A014710 a(4*n) = 2, a(4*n+2) = 1, a(2*n+1) = a(n).
%t A014710 Nest[Append[#1, If[EvenQ[#2], 2 - BitAnd[1, #2/2], #1[[Ceiling[#2/2]]]]] & @@ {#, Length@ #} &, {2}, 105] (* _Michael De Vlieger_, Apr 08 2021 *)
%o A014710 (PARI) a(n)=if(n%2==0, 2-bitand(1,n\2), a(n\2) );
%o A014710 for(n=0,122,print1(a(n),", "))
%o A014710 (Python)
%o A014710 def A014710(n):
%o A014710     s = bin(n+1)[2:]
%o A014710     m = len(s)
%o A014710     i = s[::-1].find('1')
%o A014710     return 2-int(s[m-i-2]) if m-i-2 >= 0 else 2 # _Chai Wah Wu_, Apr 08 2021
%Y A014710 See A014577 for more references and more terms.
%Y A014710 The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410. - _N. J. A. Sloane_, Jul 27 2012
%K A014710 nonn
%O A014710 0,1
%A A014710 _N. J. A. Sloane_