login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Today, Nov 11 2014, is the 4th anniversary of the launch of the new OEIS web site. 70,000 sequences have been added in these four years, all edited by volunteers. Please make a donation (tax deductible in the US) to help keep the OEIS running.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A010060 Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 0 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's. 304
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

Also called the Thue-Morse infinite word.

Fixed point of the morphism 0 --> 01, 1 --> 10, see example. [Joerg Arndt, Mar 12 2013]

The sequence is cube-free (does not contain three consecutive identical blocks) and is overlap-free (does not contain XYXYX where X is 0 or 1 and Y is any string of 0's and 1's).

a(n) = "parity sequence" = parity of number of 1's in binary representation of n.

To construct the sequence: alternate blocks of 0's and 1's of successive lengths A003159(k) - A003159(k-1), k = 1, 2, 3, ... (A003159(0) = 0). Example: since the first seven differences of A003159 are 1, 2, 1, 1, 2, 2, 2, the sequence starts with 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0. - Emeric Deutsch, Jan 10 2003

Characteristic function of A000069 (odious numbers). - Ralf Stephan, Jun 20 2003

a(n) = S2(n) mod 2, where S2(n) = sum of digits of n, n in base-2 notation. There is a class of generalized Thue-Morse sequences : Let Sk(n) = sum of digits of n; n in base-k notation. Let F(t) be some arithmetic function. Then a(n)= F(Sk(n)) mod m is a generalized Thue-Morse sequence. The classical Thue-Morse sequence is the case k=2, m=2, F(t)= 1. - Ctibor O. Zizka, Feb 12 2008

More generally, the partial sums of the generalized Thue-Morse sequences a(n) = F(Sk(n)) mod m are fractal, where Sk(n) is sum of digits of n, n in base k; F(t) is an arithmetic function; m integer. - Ctibor O. Zizka, Feb 25 2008

Starting with offset 1, = running sums mod 2 of the kneading sequence (A035263, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1,...); also parity of A005187: (1, 3, 4, 7, 8, 10, 11, 15, 16, 18, 19,...). - Gary W. Adamson, Jun 15 2008

Generalized Thue-Morse sequences mod n (n>1) = the array shown in A141803. As n -> Inf. the sequences -> (1, 2, 3,...). - Gary W. Adamson, Jul 10 2008

The Thue-Morse sequence for N = 3 = A053838, (sum of digits of n in base 3, mod 3): (0, 1, 2, 1, 2, 0, 2, 0, 1, 1, 2,...) = A004128 mod 3. - Gary W. Adamson, Aug 24 2008

For all positive integers k, the subsequence a(0) to a(2^k-1) is identical to the subsequence a(2^k+2^(k-1)) to a(2^(k+1)+2^(k-1)-1). That is to say, the first half of A_k is identical to the second half of B_k, and the second half of A_k is identical to the first quarter of B_{k+1}, which consists of the k/2 terms immediately following B_k.

Proof: The subsequence a(2^k+2^(k-1)) to a(2^(k+1)-1), the second half of B_k, is by definition formed from the subsequence a(2^(k-1)) to a(2^k-1), the second half of A_k, by interchanging its 0s and 1s. In turn, the subsequence a(2^(k-1)) to a(2^k-1), the second half of A_k, which is by definition also B_{k-1}, is by definition formed from the subsequence a(0) to a(2^(k-1)-1), the first half of A_k, which is by definition also A_{k-1}, by interchanging its 0s and 1s. Interchanging the 0s and 1s of a subsequence twice leaves it unchanged, so the subsequence a(2^k+2^(k-1)) to a(2^(k+1)-1), the second half of B_k, must be identical to the subsequence a(0) to a(2^(k-1)-1), the first half of A_k.

Also, the subsequence a(2^(k+1)) to a(2^(k+1)+2^(k-1)-1), the first quarter of B_{k+1}, is by definition formed from the subsequence a(0) to a(2^(k-1)-1), the first quarter of A_{k+1}, by interchanging its 0s and 1s. As noted above, the subsequence a(2^(k-1)) to a(2^k-1), the second half of A_k, which is by definition also B_{k-1}, is by definition formed from the subsequence a(0) to a(2^(k-1)-1), which is by definition A_{k-1}, by interchanging its 0s and 1s, as well. If two subsequences are formed from the same subsequence by interchanging its 0s and 1s then they must be identical, so the subsequence a(2^(k+1)) to a(2^(k+1)+2^(k-1)-1), the first quarter of B_{k+1}, must be identical to the subsequence a(2^(k-1)) to a(2^k-1), the second half of A_k.

Therefore the subsequence a(0), ..., a(2^(k-1)-1), a(2^(k-1)),..., a(2^k-1) is identical to the subsequence a(2^k+2^(k-1)), ..., a(2^(k+1)-1), a(2^(k+1)), ..., a(2^(k+1)+2^(k-1)-1), QED.

According to the German chess rules of 1929 a game of chess was drawn if the same sequence of moves was repeated three times consecutively. Euwe, see the references, proved that this rule could lead to infinite games. For his proof he reinvented the Thue-Morse sequence. - Johannes W. Meijer, Feb 04 2010

"Thue-Morse 0->01 & 1->10, at each stage append the previous with its complement. Start with 0, 1, 2, 3 and write them in binary. Next calculate the sum of the digits (mod 2) - that is divide the sum by 2 and use the remainder." Pickover, The Math Book.

Let s_2(n) be the sum of the base-2 digits of n and epsilon(n) = (-1)^s_2(n), the Thue-Morse sequence, then prod(n >= 0, ((2*n+1)/(2*n+2))^epsilon(n) ) = 1/sqrt(2). - Jonathan Vos Post, Jun 06 2012

Dekking shows that the constant obtained by interpreting this sequence as a binary expansion is transcendental; see also "The Ubiquitous Prouhet-Thue-Morse Sequence". - Charles R Greathouse IV, Jul 23 2013

Drmota, Mauduit, and Rivat proved that the subsequence a(n^2) is normal--see A228039. - Jonathan Sondow, Sep 03 2013

REFERENCES

A. G. M. Ahmed, AA Weaving, in Proceedings of Bridges 2013: Mathematics, Music, Art, ..., 2013; http://archive.bridgesmathart.org/2013/bridges2013-263.pdf

J.-P. Allouche, Lecture notes on automatic sequences, Krakow October 2013; http://ssdnm.mimuw.edu.pl/pliki/wyklady/allouche-uj.pdf

J.-P. Allouche and J. Shallit, The ring of k-regular sequences, II, Theoret. Computer Sci., 307 (2003), 3-29.

J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 15.

J.-P. Allouche and H. Cohen, "Dirichlet Series and Curious Infinite Products." Bull. London Math. Soc. 17, 531-538, 1985.

F. Axel et al., Vibrational modes in a one dimensional "quasi-alloy": the Morse case, J. de Physique, Colloq. C3, Supp. to No. 7, Vol. 47 (Jul 1986), pp. C3-181-C3-186; see Eq. (10).

Jason Bell, Michael Coons, and Eric Rowland, "The Rational-Transcendental Dichotomy of Mahler Functions", Journal of Integer Sequences, Vol. 16 (2013), #13.2.10.

J. Berstel and J. Karhumaki, Combinatorics on words - a tutorial, Bull. EATCS, #79 (2003), pp. 178-228.

B. Bollobas, The Art of Mathematics: Coffee Time in Memphis, Cambridge, 2006, p. 224.

S. Brlek, Enumeration of factors in the Thue-Morse word, Discrete Applied Math., 24 (1989), 83-96. doi:10.1016/0166-218X(92)90274-E.

Yann Bugeaud and Guo-Niu Han,, A combinatorial proof of the non-vanishing of Hankel determinants of the Thue-Morse sequence, Electronic Journal of Combinatorics 21(3) (2014), #P3.26.

Y. Bugeaud and M. Queffélec, On Rational Approximation of the Binary Thue-Morse-Mahler Number, Journal of Integer Sequences, 16 (2013), #13.2.3.

J. Cooper and A. Dutle, Greedy Galois Games, Amer. Math. Mnthly, 120 (2013), 441-451.

A. de Luca and S. Varricchio, Some combinatorial properties of the Thue-Morse sequence and a problem in semigroups, Theoret. Comput. Sci. 63 (1989), 333-348. - From N. J. A. Sloane, Jul 10 2012

F. Dejean, Sur un theoreme de Thue. J. Combinatorial Theory Ser. A 13 (1972), 90-99.

F. M. Dekking, Transcendence du nombre de Thue-Morse, Comptes Rendus de l'Academie des Sciences de Paris 285 (1977), pp. 157-160.

F. M. Dekking, On repetitions of blocks in binary sequences. J. Combinatorial Theory Ser. A 20 (1976), no. 3, pp. 292-299. MR0429728(55 #2739)

Dubickas, Artūras. On a sequence related to that of Thue-Morse and its applications. Discrete Math. 307 (2007), no. 9-10, 1082--1093. MR2292537 (2008b:11086).

Fabien Durand, Julien Leroy, and Gwenaël Richomme, "Do the Properties of an S-adic Representation Determine Factor Complexity?", Journal of Integer Sequences, Vol. 16 (2013), #13.2.6.

J. Endrullis, D. Hendriks and J. W. Klop. Degrees of streams, http://www.cs.vu.nl/~diem/publication/pdf/degrees.pdf

M. Euwe, Mengentheoretische Betrachtungen Über das Schachspiel, Proceedings Koninklijke Nederlandse Akademie van Wetenschappen, Amsterdam, Vol. 32 (5): 633-642, 1929. [From Johannes W. Meijer, Feb 04 2010.]

S. Ferenczi, Complexity of sequences and dynamical systems, Discrete Math., 206 (1999), 145-154.

S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 6.8.

W. H. Gottschalk and G. A. Hedlund, Topological Dynamics. American Mathematical Society, Colloquium Publications, Vol. 36, Providence, RI, 1955, p. 105.

J. Grytczuk, Thue type problems for graphs, points and numbers, Discrete Math., 308 (2008), 4419-4429.

G. A. Hedlund, Remarks on the work of Axel Thue on sequences, Nordisk Mat. Tid., 15 (1967), 148-150.

A. Hof, O. Knill and B. Simon, Singular continuous spectrum for palindromic Schroedinger operators, Commun. Math. Phys. 174 (1995), 149-159.

Mari Huova and Juhani Karhumäki, "On Unavoidability of k-abelian Squares in Pure Morphic Words", Journal of Integer Sequences, Vol. 16 (2013), #13.2.9.

B. Kitchens, Review of "Computational Ergodic Theory" by G. H. Choe, Bull. Amer. Math. Soc., 44 (2007), 147-155.

Naoki Kobayashi, Kazutaka Matsuda and Ayumi Shinohara, Functional Programs as Compressed Data, http://www.kb.ecei.tohoku.ac.jp/~koba/papers/pepm2012-full.pdf

Le Breton, Xavier, Linear independence of automatic formal power series. Discrete Math. 306 (2006), no. 15, 1776-1780.

M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 23.

Mauduit, Christian. Multiplicative properties of the Thue-Morse sequence. Period. Math. Hungar. 43 (2001), no. 1-2, 137--153. MR1830572 (2002i:11081)

Mignosi, F.; Restivo, A.; Sciortino, M. Words and forbidden factors. WORDS (Rouen, 1999). Theoret. Comput. Sci. 273 (2002), no. 1-2, 99--117. MR1872445 (2002m:68096) - From N. J. A. Sloane, Jul 10 2012

M. Morse, Recurrent geodesics on a surface of negative curvature, Trans. Amer. Math. Soc., 22 (1921), 84-100.

K. Nakano, Shall We Juggle, Coinductively?, in Certified Programs and Proofs, Lecture Notes in Computer Science Volume 7679, 2012, pp. 160-172, DOI 10.1007/978-3-642-35308-6_14.

H. D. Nguyen, A mixing of Prouhet-Thue-Morse sequences and Rademacher functions, http://www.rowan.edu/colleges/csm/departments/math/facultystaff/nguyen/papers/mixing-ptm-rademacher.pdf, 2014

C. A. Pickover, Wonders of Numbers, Adventures in Mathematics, Mind and Meaning, Chapter 17, 'The Pipes of Papua,' Oxford University Press, Oxford, England, 2000, pages 34 - 38.

C. A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 60.

Clifford A. Pickover, The Math Book, From Pythagoras to the 57th Dimension, 250 Milestones in the History of Mathematics, Sterling Publ., NY, 2009, page 316.

Narad Rampersad and Elise Vaslet, "On Highly Repetitive and Power Free Words", Journal of Integer Sequences, Vol. 16 (2013), #13.2.7.

G. Richomme, K. Saari, L. Q. Zamboni, Abelian complexity in minimal subshifts, J. London Math. Soc. 83(1) (2011) 79-95.

M. Rigo, P. Salimov, and E. Vandomme, "Some Properties of Abelian Return Words", Journal of Integer Sequences, Vol. 16 (2013), #13.2.5.

Benoit Rittaud, Elise Janvresse, Emmanuel Lesigne and Jean-Christophe Novelli, Quand les maths se font discretes, Le Pommier, 2008 (ISBN 978-2-7465-0370-0).

A. Salomaa, Jewels of Formal Language Theory. Computer Science Press, Rockville, MD, 1981, p. 6.

Shallit, J. O. "On Infinite Products Associated with Sums of Digits." J. Number Th. 21, 128-134, 1985.

S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 890.

LINKS

N. J. A. Sloane, Table of n, a(n) for n = 0..16383

A. Aksenov, The Newman phenomenon and Lucas sequence, arXiv preprint arXiv:1108.5352, 2011

Joerg Arndt, Matters Computational (The Fxtbook), p.44

J.-P. Allouche, Series and infinite products related to binary expansions of integers

J.-P. Allouche, Andre Arnold, Jean Berstel, Srecko Brlek, William Jockusch, Simon Plouffe and Bruce E. Sagan, A sequence related to that of Thue-Morse, Discrete Math., 139 (1995), 455-461.

J.-P. Allouche and M. Mendes France, Automata and Automatic Sequences.

J.-P. Allouche and J. Shallit, The Ring of k-regular Sequences, II

J.-P. Allouche and Jeffrey Shallit, The Ubiquitous Prouhet-Thue-Morse Sequence, in C. Ding. T. Helleseth and H. Niederreiter, eds., Sequences and Their Applications: Proceedings of SETA '98, Springer-Verlag, 1999, pp. 1-16.

Ricardo Astudillo, On a Class of Thue-Morse Type Sequences, J. Integer Seqs., Vol. 6, 2003.

M. Baake, U. Grimm, J. Nilsson, Scaling of the Thue-Morse diffraction measure, arXiv preprint arXiv:1311.4371, 2013

Jean Berstel, Home Page

Bertazzon J.-F., Resolution of an integral equation with the Thue-Morse sequence, arXiv:1201.2502v1 [math.CO], Jan 12, 2012.

E. Deutsch and B. E. Sagan, Congruences for Catalan and Motzkin numbers and related sequences, J. Num. Theory 117 (2006), 191-215.

M. Drmota, C. Mauduit, J. Rivat, The Thue-Morse Sequence Along The Squares is Normal, Abstract, ÖMG-DMV Congress, 2013.

A. S. Fraenkel, Home Page

A. S. Fraenkel, New games related to old and new sequences, INTEGERS, Electronic J. of Combinatorial Number Theory, Vol. 4, Paper G6, 2004.

Michael Gilleland, Some Self-Similar Integer Sequences

Daniel Goc, Luke Schaeffer and Jeffrey Shallit, The Subword Complexity of k-Automatic Sequences is k-Synchronized, arXiv 1206.5352, Jun 28 2012.

Dimitri Hendriks, Frits G. W. Dannenberg, Jorg Endrullis, Mark Dow and Jan Willem Klop, Arithmetic Self-Similarity of Infinite Sequences, arXiv preprint 1201.3786, 2012.

A. M. Hinz, S. Klavžar, U. Milutinović, C. Petr, The Tower of Hanoi - Myths and Maths, Birkhäuser 2013. See page 79. Book's website

Tanya Khovanova, There are no coincidences, arXiv preprint 1410.2193, 2014

Philip Lafrance, Narad Rampersad, Randy Yee, Some properties of a Rudin-Shapiro-like sequence, arXiv:1408.2277 [math.CO], 2014.

C. Mauduit, J. Rivat, La somme des chiffres des carres, Acta Mathem. 203 (1) (2009) 107-148.

M. Morse, Recurrent geodesics on a surface of negative curvature (page images), Trans. Amer. Math. Soc., 22 (1921), 84-100.

A. Parreau, M. Rigo, E. Rowland, E. Vandomme, A new approach to the 2-regularity of the l-abelian complexity of 2-automatic sequences, arXiv preprint arXiv:1405.3532, 2014.

C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," Zentralblatt review

N. J. A. Sloane, The first 1000 terms as a string

Eric Weisstein's World of Mathematics, Thue-Morse Sequence

Eric Weisstein's World of Mathematics, Thue-Morse Constant

Eric Weisstein's World of Mathematics, Parity

J. Winter, M. M. Bonsangue and J. J. M. M. Rutten, Context-free coalgebras, 2013;

Index entries for "core" sequences

Index entries for sequences related to binary expansion of n

Index entries for characteristic functions

FORMULA

a(2n) = a(n), a(2n+1) = 1 - a(n), a(0) = 0. Also, a(k+2^m) = 1 - a(k) if 0 <= k < 2^m.

If n = Sum b_i*2^i is the binary expansion of n then a(n) = Sum b_i (mod 2).

Let S(0) = 0 and for k >= 1, construct S(k) from S(k-1) by mapping 0 -> 01 and 1 -> 10; sequence is S(infinity).

G.f.: (1/(1-x) - product_{k >= 0} 1 - x^(2^k))/2. - Benoit Cloitre, Apr 23 2003

a(0) = 0, a(n) = (n+a(floor(n/2))) mod 2; also a(0) = 0, a(n) = (n-a(floor(n/2))) mod 2. - Benoit Cloitre, Dec 10 2003

a(n) = -1 + sum(k = 0, n, binomial(n, k){mod 2}) {mod 3} = -1 + A001316(n) {mod 3}. - Benoit Cloitre, May 09 2004

Let b(1) = 1 and b(n) = b(ceiling(n/2)) - b(floor(n/2)) then a(n-1) = (1/2)*(1-b(2n-1)). - Benoit Cloitre, Apr 26 2005

a(n) = 1 - A010059(n) = A001285(n) - 1. - Ralf Stephan, Jun 20 2003

a(n) = A001969(n) - 2n. - Franklin T. Adams-Watters, Aug 28 2006

a(n) = A115384(n) - A115384(n-1) for n > 0. - Reinhard Zumkeller, Aug 26 2007

For n >= 0, a(A004760(n+1)) = 1 - a(n). - Vladimir Shevelev, Apr 25 2009

a(A160217(n)) = 1 - a(n). - Vladimir Shevelev, May 05 2009

A010060(n) == A000069(n)(mod 2). - Robert G. Wilson v, Jan 18 2012

a(n) = A000035(A000120(n)). - Omar E. Pol, Oct 26 2013

a(n) = A000035(A193231(n)). - Antti Karttunen, Dec 27 2013

a(n) + A181155(n-1) = 2n  for n >= 1.  - Clark Kimberling, Oct 06 2014

EXAMPLE

The evolution starting at 0 is:

.0

.0, 1

.0, 1, 1, 0

.0, 1, 1, 0, 1, 0, 0, 1

.0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0

.0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1

.......

A_2 = 0 1 1 0, so B_2 = 1 0 0 1 and A_3 = A_2 B_2 = 0 1 1 0 1 0 0 1.

From Joerg Arndt, Mar 12 2013: (Start)

The first steps of the iterated substitution are

Start: 0

Rules:

  0 --> 01

  1 --> 10

-------------

0:   (#=1)

  0

1:   (#=2)

  01

2:   (#=4)

  0110

3:   (#=8)

  01101001

4:   (#=16)

  0110100110010110

5:   (#=32)

  01101001100101101001011001101001

6:   (#=64)

  0110100110010110100101100110100110010110011010010110100110010110

(End)

From Omar E. Pol, Oct 28 2013: (Start)

Written as an irregular triangle in which row lengths is A011782, the sequence begins:

0;

1;

1,0;

1,0,0,1;

1,0,0,1,0,1,1,0;

1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1;

1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0;

It appears that: row j lists the first A011782(j) terms of A010059, with j >= 0; row sums give A166444 which is also 0 together with A011782; right border gives A000035.

(End).

MAPLE

s := proc(k) local i, ans; ans := [ 0, 1 ]; for i from 0 to k do ans := [ op(ans), op(map(n->(n+1) mod 2, ans)) ] od; return ans; end; t1 := s(6); A010060 := n->t1[n]; # s(k) gives first 2^(k+2) terms.

a := proc(k) b := [0]: for n from 1 to k do b := subs({0=[0, 1], 1=[1, 0]}, b) od: b; end; # a(k), after the removal of the brackets, gives the first 2^k terms. # Example: a(3); gives [[[[0, 1], [1, 0]], [[1, 0], [0, 1]]]]

A010060:=proc(n) local n2: n2:=convert(n, base, 2): sum(n2[j], j=1..nops(n2)) mod 2; end:

seq(A010060(n), n=0..104); # Emeric Deutsch, Mar 19 2005

map(`-`, convert(StringTools[ThueMorse](1000), bytes), 48); # Robert Israel, Sep 22 2014

MATHEMATICA

Table[ If[ OddQ[ Count[ IntegerDigits[n, 2], 1]], 1, 0], {n, 0, 100}];

mt = 0; Do[ mt = ToString[mt] <> ToString[(10^(2^n) - 1)/9 - ToExpression[mt] ], {n, 0, 6} ]; Prepend[ RealDigits[ N[ ToExpression[mt], 2^7] ] [ [1] ], 0]

Mod[ Count[ #, 1 ]& /@Table[ IntegerDigits[ i, 2 ], {i, 0, 2^7 - 1} ], 2 ] (* Harlan J. Brothers, Feb 05 2005 *)

Nest[ Flatten[ # /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {0}, 7] (* Robert G. Wilson v Sep 26 2006 *)

a[n_] := If[n == 0, 0, If[Mod[n, 2] == 0, a[n/2], 1 - a[(n - 1)/2]]] (* Ben Branman, Oct 22 2010 *)

PROG

(Haskell)

a010060 n = a010060_list !! n

a010060_list =

   0 : interleave (complement a010060_list) (tail a010060_list)

   where complement = map (1 - )

         interleave (x:xs) ys = x : interleave ys xs

-- Doug McIlroy (doug(AT)cs.dartmouth.edu), Jun 29 2003

-- Edited by Reinhard Zumkeller, Oct 03 2012

(PARI) a(n)=if(n<1, 0, sum(k=0, length(binary(n))-1, bittest(n, k))%2)

(PARI) a(n)=if(n<1, 0, subst(Pol(binary(n)), x, 1)%2)

(PARI) { default(realprecision, 6100); x=0.0; m=20080; for (n=1, m-1, x=x+x; x=x+sum(k=0, length(binary(n))-1, bittest(n, k))%2); x=2*x/2^m; for (n=0, 20000, d=floor(x); x=(x-d)*2; write("b010060.txt", n, " ", d)); } \\ Harry J. Smith, Apr 28 2009

(PARI) a(n)=hammingweight(n)%2 \\ Charles R Greathouse IV, Mar 22 2013

CROSSREFS

Cf. A001285 (for 1, 2 version), A010059 (for 1, 0 version), A106400 (for +1, -1 version), A048707. A010060(n)=A000120(n) mod 2.

Cf. A007413, A080813, A080814, A036581, A108694. See also the Thue (or Roth) constant A014578.

Cf. also A001969, A035263, A005187, A115384, A132680, A141803, A104248, A193231.

Backward first differences give A029883.

Cf. A004128, A053838, A059448, A171900, A161916, A214212, A005942 (subword complexity), A010693 (Abelian complexity), A225186 (squares), A228039 (a(n^2)).

Sequence in context: A029691 A156595 A143222 * A118247 A122257 A129950

Adjacent sequences:  A010057 A010058 A010059 * A010061 A010062 A010063

KEYWORD

nonn,core,easy,nice

AUTHOR

N. J. A. Sloane

EXTENSIONS

Additional comments from Robert G. Wilson v, Dec 29 2000

STATUS

approved

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

Content is available under The OEIS End-User License Agreement .

Last modified November 24 20:53 EST 2014. Contains 249928 sequences.