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.
%I A014707 #114 Aug 11 2025 10:56:20 %S A014707 0,0,1,0,0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,1,1,0,0,0, %T A014707 1,0,0,1,1,0,0,0,1,1,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,1,0,1,1,0,0,0,1,0, %U A014707 0,1,1,0,0,0,1,1,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0 %N A014707 a(4n) = 0, a(4n+2) = 1, a(2n+1) = a(n). %C A014707 The regular paper-folding (or dragon curve) sequence. %C A014707 It appears that the sequence of run lengths is A088431. - _Dimitri Hendriks_, May 06 2010 %C A014707 Runs of three consecutive ones appear around positions n = 22, 46, 54, 86, 94, 118, 150, 174, 182, ..., or for n of the form 2^(k+3)*(4*t+3)-2, k >= 0, t >= 0. - _Vladimir Shevelev_, Mar 19 2011 %D A014707 Guy Melançon, Factorizing infinite words using Maple, MapleTech journal, Vol. 4, No. 1, 1997, pp. 34-42, esp. p. 36. %H A014707 Reinhard Zumkeller, <a href="/A014707/b014707.txt">Table of n, a(n) for n = 0..10000</a> %H A014707 Jean-Paul Allouche, Anna Lubiw, Michel France, Alfred van der Poorten, and Jeffrey Shallit, <a href="https://doi.org/10.4064/aa-77-1-77-96">Convergents of folded continued fractions</a>, Acta Arithmetica 77 (1996), 77-96. %H A014707 Cristina Ballantine and George Beck, <a href="https://arxiv.org/abs/2303.11493">Partitions enumerated by self-similar sequences</a>, arXiv:2303.11493 [math.CO], 2023. %H A014707 Paul Barry, <a href="https://arxiv.org/abs/2104.05593">On the Gap-sum and Gap-product Sequences of Integer Sequences</a>, arXiv:2104.05593 [math.CO], 2021. %H A014707 Jörg Endrullis, Dimitri Hendriks, and Jan Willem Klop, <a href="http://joerg.endrullis.de/assets/papers/streams-degrees-2011.pdf">Degrees of streams</a>, see table 1 "PF". %H A014707 Jui-Yi Kao, Narad Rampersad, Jeffrey Shallit, and Manuel Silva, <a href="https://doi.org/10.1016/j.tcs.2007.10.039">Words avoiding repetitions in arithmetic progressions</a>, Theoretical Computer Science, Vol. 391, No. 1-2 (2008), pp. 126-137; <a href="https://arxiv.org/abs/math/0608607">arXiv preprint</a>, arXiv:math/0608607 [math.CO], 2006. %H A014707 Guy Melançon, <a href="http://dx.doi.org/10.1007/3-540-60922-9_13">Lyndon factorization of infinite words</a>, STACS 96 (Grenoble, 1996), 147-154, Lecture Notes in Comput. Sci., 1046, Springer, Berlin, 1996. Math. Rev. 98h:68188. %H A014707 Jeffrey Shallit, <a href="https://arxiv.org/abs/2501.00784">Cloitre's Self-Generating Sequence</a>, arXiv:2501.00784 [math.CO], 2025. %H A014707 László Tóth, <a href="https://arxiv.org/abs/2508.04151">Evaluating zeta(s) At Odd Positive Integers Using Automatic Dirichlet Series</a>, arXiv:2508.04151 [math.NT], 2025. %H A014707 <a href="/index/Fo#fold">Index entries for sequences obtained by enumerating foldings</a>. %F A014707 a(A091072(n)-1) = 0; a(A091067(n)-1) = 1. - _Reinhard Zumkeller_, Sep 28 2011 [Adjusted to match offset by _Peter Munn_, Jul 01 2022] %F A014707 a(n) = (1-Jacobi(-1,n+1))/2 (cf. A034947). - _N. J. A. Sloane_, Jul 27 2012 [Adjusted to match offset by _Peter Munn_, Jul 01 2022] %F A014707 Set a=0, 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 A014707 a((2*n+1)*2^p-1) = n mod 2, p >= 0. - _Johannes W. Meijer_, Jan 28 2013 %F A014707 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - _Amiram Eldar_, Aug 31 2024 %p A014707 nmax:=92: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 0 to ceil(nmax/(p+2))+1 do a((2*n+1)*2^p-1) := n mod 2 od: od: seq(a(n), n=0..nmax); # _Johannes W. Meijer_, Jan 28 2013 %p A014707 # second Maple program: %p A014707 a:= proc(n) option remember; %p A014707 `if`(n::even, irem(n/2, 2), a((n-1)/2)) %p A014707 end: %p A014707 seq(a(n), n=0..92); # _Alois P. Heinz_, Jun 27 2022 %t A014707 a[n_ /; Mod[n, 4] == 0] = 0; a[n_ /; Mod[n, 4] == 2] = 1; a[n_ /; Mod[n, 2] == 1] := a[n] = a[(n - 1)/2]; Table[a[n],{n,0,92}] (* _Jean-François Alcover_, May 17 2011 *) %t A014707 (1 - JacobiSymbol[-1, Range[100]])/2 (* _Paolo Xausa_, May 26 2024 *) %o A014707 (Haskell) %o A014707 a014707 n = a014707_list !! n %o A014707 a014707_list = f 0 $ cycle [0,0,1,0] where %o A014707 f i (x:_:xs) = x : a014707 i : f (i+1) xs %o A014707 -- _Reinhard Zumkeller_, Sep 28 2011 %o A014707 (Python) %o A014707 def A014707(n): %o A014707 s = bin(n+1)[2:] %o A014707 m = len(s) %o A014707 i = s[::-1].find('1') %o A014707 return int(s[m-i-2]) if m-i-2 >= 0 else 0 # _Chai Wah Wu_, Apr 08 2021 %o A014707 (Python) %o A014707 def A014707(n): n+=1; h=n&-n; n=n&(h<<1); return int(n!=0) %o A014707 print([A014707(n) for n in range(93)]) # _Michael S. Branicky_, Mar 29 2024 after _Joerg Arndt_ %o A014707 (PARI) a(n)=n+=1;my(h=bitand(n,-n));n=bitand(n,h<<1);n!=0; \\ _Joerg Arndt_, Apr 09 2021 %Y A014707 Equals 1 - A014577, which see for further references. Also a(n) = A038189(n+1). %Y A014707 The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410. %Y A014707 Cf. A220466 %K A014707 nonn,easy,nice %O A014707 0,1 %A A014707 _N. J. A. Sloane_ %E A014707 More terms from Scott C. Lindhurst (ScottL(AT)alumni.princeton.edu)