login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A014707 a(4n) = 0, a(4n+2) = 1, a(2n+1) = a(n). 23

%I #98 Mar 29 2024 15:30:30

%S 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 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 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 a(4n) = 0, a(4n+2) = 1, a(2n+1) = a(n).

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

%C It appears that the sequence of run lengths is A088431. - _Dimitri Hendriks_, May 06 2010

%C 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 G. Melançon, Factorizing infinite words using Maple, MapleTech journal, vol. 4, no. 1, 1997, pp. 34-42, esp. p. 36.

%H Reinhard Zumkeller, <a href="/A014707/b014707.txt">Table of n, a(n) for n = 0..10000</a>

%H J.-P. Allouche, M. Mendes France, A. Lubiw, A. J. van der Poorten and J. 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 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 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 G. J. Endrullis, D. Hendriks and J. W. Klop, <a href="http://joerg.endrullis.de/assets/papers/streams-degrees-2011.pdf">Degrees of streams</a>, see table 1 "PF".

%H J.-Y. Kao et al., <a href="http://arXiv.org/abs/math.CO/0608607">Words avoiding repetitions in arithmetic progressions</a>

%H G. 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 <a href="/index/Fo#fold">Index entries for sequences obtained by enumerating foldings</a>

%F 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 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 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 a((2*n+1)*2^p-1) = n mod 2, p >= 0. - _Johannes W. Meijer_, Jan 28 2013

%p 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 # second Maple program:

%p a:= proc(n) option remember;

%p `if`(n::even, irem(n/2, 2), a((n-1)/2))

%p end:

%p seq(a(n), n=0..92); # _Alois P. Heinz_, Jun 27 2022

%t 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 *)

%o (Haskell)

%o a014707 n = a014707_list !! n

%o a014707_list = f 0 $ cycle [0,0,1,0] where

%o f i (x:_:xs) = x : a014707 i : f (i+1) xs

%o -- _Reinhard Zumkeller_, Sep 28 2011

%o (Python)

%o def A014707(n):

%o s = bin(n+1)[2:]

%o m = len(s)

%o i = s[::-1].find('1')

%o return int(s[m-i-2]) if m-i-2 >= 0 else 0 # _Chai Wah Wu_, Apr 08 2021

%o (Python)

%o def A014707(n): n+=1; h=n&-n; n=n&(h<<1); return int(n!=0)

%o print([A014707(n) for n in range(93)]) # _Michael S. Branicky_, Mar 29 2024 after _Joerg Arndt_

%o (PARI) a(n)=n+=1;my(h=bitand(n,-n));n=bitand(n,h<<1);n!=0; \\ _Joerg Arndt_, Apr 09 2021

%Y Equals 1 - A014577, which see for further references. Also a(n) = A038189(n+1).

%Y The following are all essentially the same sequence: A014577, A014707, A014709, A014710, A034947, A038189, A082410.

%Y Cf. A220466

%K nonn,easy,nice

%O 0,1

%A _N. J. A. Sloane_

%E More terms from Scott C. Lindhurst (ScottL(AT)alumni.princeton.edu)

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 28 05:00 EDT 2024. Contains 372020 sequences. (Running on oeis4.)