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.

Showing 1-10 of 22 results. Next

A026490 Length of n-th run of identical symbols in A026465.

Original entry on oeis.org

1, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3
Offset: 1

Views

Author

Keywords

Comments

From Jean-Paul Allouche and Michel Dekking, Sep 08 2019: (Start)
This sequence is a morphic sequence, i.e., the letter to letter image of a fixed point of a morphism. The morphism is defined on a four-letter alphabet:
1 -> 322, 2 -> 1212, 3 -> 323232, 4 -> 412.
The letter-to-letter map is given by 1 -> 1, 2 -> 2, 3 -> 3, 4 -> 1. The fixed point is the fixed point with prefix 4.
How is this obtained? Note that A026465 only has runs of the forms 2, 11 and 222. A026465 itself is the fixed point of the morphism alpha: 1 -> 121, 2 -> 12221.
The images of the runs under alpha are alpha(2) = 12221, alpha(11) = 121121, alpha(222) = 122211222112221. Coding the runs with their lengths this induces a morphism on the coded runs: 1 -> 32, 2 -> 1212, 3 -> 323232.
Here we use the fact that all three alpha-images have 1 as a prefix and as a suffix. This yields the 2 (coding of 11) at the end of the three images 32, 1212, 323232. The letter 4 is then added to deal with the somewhat strange fact that a(1)=1, a(2)=1. Strange, because the word 11 occurs nowhere else in (a(n)).
Actually, one can show in a similar way, using the square of the morphism 1 -> 2, 2 -> 211 instead of the morphism alpha, that (a(n+1)) = 1,2,3,2,1,2,...
is a purely morphic sequence, fixed point of the morphism 1 -> 123, 2 -> 212, 3 -> 1232323.
One sees from this (by projecting 1, 3 -> 1, 2 -> 2) that (a(n)) has the property a(2n+1) = 2 for all n > 1. Also, by removing the 2's, one sees that the sequence of 1's and 3's is the fixed point of the morphism 1 -> 131, 3 -> 13331, which is the sequence A080426.
(End)
Because the absolute difference between any pair of adjacent terms is 1 (excluding the first pair of adjacent terms), the length of n-th runs of this sequence is A054977, that is, 2 followed by an infinite sequence of 1's. - Keith J. Bauer, Feb 10 2024

Crossrefs

Programs

  • Haskell
    import Data.List (group)
    a026490 n = a026490_list !! (n-1)
    a026490_list = map length $ group a026465_list
    -- Reinhard Zumkeller, Jul 15 2014
    
  • Mathematica
    Length /@ Split[Length /@ Split[ThueMorse[Range[0, 200]]]] (* Vladimir Reshetnikov, Apr 27 2016 *)
  • Python
    def A026490(n):
        if n==1: return 1
        if n&1: return 2
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        m = n>>1
        return bisection(lambda x:f(x)+m,m,m)-bisection(lambda x:f(x)+m-1,m-1,m-1)-1 # Chai Wah Wu, Jan 29 2025

Formula

a(1)=1, a(2n) = A080426(n) for all n > 0, a(2n+1) = 2 for all n > 1. - Jean-Paul Allouche and Michel Dekking, Sep 08 2019

A187061 Digits of the decimal expansion the constant whose continued fraction expansion is given by (a suffix of) A026465 (just start from the second term): [0;2,1,1,2,2,2,1,1,2,1,1,...]=0.3867499707....

Original entry on oeis.org

3, 8, 6, 7, 4, 9, 9, 7, 0, 7, 1, 4, 3, 0, 0, 7, 0, 6, 1, 7, 1, 5, 2, 4, 8, 0, 3, 4, 8, 5, 5, 8, 0, 9, 3, 9, 6, 6, 1, 4, 4, 7, 6, 1, 5, 5, 6, 3, 0, 7, 7, 5, 0, 5, 1, 4, 7, 5, 0, 2, 8, 0, 5, 6, 8, 1, 2, 2, 4, 0, 7, 0, 7, 5, 8, 0, 5, 2, 9, 0, 9, 1
Offset: 0

Views

Author

Carlo Carminati, Mar 03 2011

Keywords

Comments

Since the continued fraction of 0.3867499707... is a sequence which is the fixed point of a substitution, this constant is transcendental.

Crossrefs

Cf. A026465.

Programs

  • Maple
    ## period-doubling routine (see A026465):
    double:=proc(SS)
    NEW:=[op(S), op(S)]:
    if op(nops(NEW), NEW)=1
    then NEW:=[seq(op(j, NEW), j=1..nops(NEW)-2), op(nops(NEW)-1, NEW)+1]:
    else NEW:=[seq(op(j, NEW), j=1..nops(NEW)-1), op(nops(NEW)-1, NEW)-1, 1]:
    fi:
    end proc:
    # 10 loops of the above routine generate the first 1365 terms of the sequence
    S:=[2]:
    for j from 1 to 10  do S:=double(S); od:
    ## transform the list S into a continued fraction:
    Digits:=500;
    with(numtheory);
    q:=evalf(invcfrac([[0],S]));
    ## list of digits:
    L:=[seq(floor(q*10**j) - 10*floor(q*10**(j-1)), j=1..200)];
  • Mathematica
    First[RealDigits[FromContinuedFraction[ThueMorse[Range[550]]] - 1, 10, 100]] (* Paolo Xausa, Apr 04 2024 *)

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.

Original entry on oeis.org

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
Offset: 0

Views

Author

Keywords

Comments

Named after Axel Thue, whose name is pronounced as if it were spelled "Tü" where the ü sound is roughly as in the German word üben. (It is incorrect to say "Too-ee" or "Too-eh".) - N. J. A. Sloane, Jun 12 2018
Also called the Thue-Morse infinite word, or the Morse-Hedlund sequence, or the parity sequence.
Fixed point of the morphism 0 --> 01, 1 --> 10, see example. - Joerg Arndt, Mar 12 2013
The sequence is cubefree (does not contain three consecutive identical blocks) [see Offner for a direct proof] 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*t. - Ctibor O. Zizka, Feb 12 2008 (with correction from Daniel Hug, May 19 2017)
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 -> infinity 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 0's and 1's. 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 0's and 1's. Interchanging the 0's and 1's 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 0's and 1's. 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 0's and 1's, as well. If two subsequences are formed from the same subsequence by interchanging its 0's and 1's 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
Although the probability of a 0 or 1 is equal, guesses predicated on the latest bit seen produce a correct match 2 out of 3 times. - Bill McEachen, Mar 13 2015
From a(0) to a(2n+1), there are n+1 terms equal to 0 and n+1 terms equal to 1 (see Hassan Tarfaoui link, Concours Général 1990). - Bernard Schott, Jan 21 2022

Examples

			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)
		

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 15.
  • 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.
  • Currie, James D. "Non-repetitive words: Ages and essences." Combinatorica 16.1 (1996): 19-40
  • Colin Defant, Anti-Power Prefixes of the Thue-Morse Word, Journal of Combinatorics, 24(1) (2017), #P1.32
  • F. M. Dekking, Transcendance 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)
  • Dekking, Michel, Michel Mendès France, and Alf van der Poorten. "Folds." The Mathematical Intelligencer, 4.3 (1982): 130-138 & front cover, and 4:4 (1982): 173-181 (printed in two parts).
  • 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.
  • M. Euwe, Mengentheoretische Betrachtungen Über das Schachspiel, Proceedings Koninklijke Nederlandse Akademie van Wetenschappen, Amsterdam, Vol. 32 (5): 633-642, 1929.
  • 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.
  • 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.
  • 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.
  • Donald MacMurray, A mathematician gives an hour to chess, Chess Review 6 (No. 10, 1938), 238. [Discusses Marston's 1938 article]
  • Mauduit, Christian. Multiplicative properties of the Thue-Morse sequence. Period. Math. Hungar. 43 (2001), no. 1-2, 137--153. MR1830572 (2002i:11081)
  • 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.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • 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 discrètes, 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.
  • Ian Stewart, "Feedback", Mathematical Recreations Column, Scientific American, 274 (No. 3, 1996), page 109 [Historical notes on this sequence]
  • Thomas Stoll, On digital blocks of polynomial values and extractions in the Rudin-Shapiro sequence, RAIRO - Theoretical Informatics and Applications (RAIRO: ITA), EDP Sciences, 2016, 50, pp. 93-99. .
  • A. Thue. Über unendliche Zeichenreihen, Norske Vid. Selsk. Skr. I. Mat. Nat. Kl. Christiania, No. 7 (1906), 1-22.
  • A. Thue, Über die gegenseitige Lage gleicher Teile gewisser Zeichenreihen, Norske Vid. Selsk. Skr. I. Mat. Nat. Kl. Christiania, 1 (1912), 1-67.
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 890.

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, also A014571.
Run lengths give A026465. Backward first differences give A029883.
Cf. A004128, A053838, A059448, A171900, A161916, A214212, A005942 (subword complexity), A010693 (Abelian complexity), A225186 (squares), A228039 (a(n^2)), A282317.
Sequences mentioned in the Allouche et al. "Taxonomy" paper, listed by example number: 1: A003849, 2: A010060, 3: A010056, 4: A020985 and A020987, 5: A191818, 6: A316340 and A273129, 18: A316341, 19: A030302, 20: A063438, 21: A316342, 22: A316343, 23: A003849 minus its first term, 24: A316344, 25: A316345 and A316824, 26: A020985 and A020987, 27: A316825, 28: A159689, 29: A049320, 30: A003849, 31: A316826, 32: A316827, 33: A316828, 34: A316344, 35: A043529, 36: A316829, 37: A010060.

Programs

  • 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
    
  • 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)
        add(i,i=convert(n, base, 2)) mod 2 ;
    end proc:
    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 *)
    a[n_] := Mod[Length[FixedPointList[BitAnd[#, # - 1] &, n]], 2] (* Jan Mangaldan, Jul 23 2015 *)
    Table[2/3 (1 - Cos[Pi/3 (n - Sum[(-1)^Binomial[n, k], {k, 1, n}])]), {n, 0, 100}] (* or, for version 10.2 or higher *) Table[ThueMorse[n], {n, 0, 100}] (* Vladimir Reshetnikov, May 06 2016 *)
    ThueMorse[Range[0, 100]] (* The program uses the ThueMorse function from Mathematica version 11 *) (* Harvey P. Dale, Aug 11 2016 *)
    Nest[Join[#, 1 - #] &, {0}, 7] (* Paolo Xausa, Oct 25 2024 *)
  • 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
    
  • Python
    A010060_list = [0]
    for _ in range(14):
        A010060_list += [1-d for d in A010060_list] # Chai Wah Wu, Mar 04 2016
    
  • Python
    def A010060(n): return n.bit_count()&1 # Chai Wah Wu, Mar 01 2023
    
  • R
    maxrow <- 8 # by choice
    b01 <- 1
    for(m in 0:maxrow) for(k in 0:(2^m-1)){
    b01[2^(m+1)+    k] <-   b01[2^m+k]
    b01[2^(m+1)+2^m+k] <- 1-b01[2^m+k]
    }
    (b01 <- c(0,b01))
    # Yosu Yurramendi, Apr 10 2017

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
a(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
G.f. A(x) satisfies: A(x) = x / (1 - x^2) + (1 - x) * A(x^2). - Ilya Gutkovskiy, Jul 29 2021
From Bernard Schott, Jan 21 2022: (Start)
a(n) = a(n*2^k) for k >= 0.
a((2^m-1)^2) = (1-(-1)^m)/2 (see Hassan Tarfaoui link, Concours Général 1990). (End)

A003159 Numbers whose binary representation ends in an even number of zeros.

Original entry on oeis.org

1, 3, 4, 5, 7, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 25, 27, 28, 29, 31, 33, 35, 36, 37, 39, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 89, 91, 92, 93, 95, 97, 99, 100, 101, 103, 105
Offset: 1

Views

Author

Keywords

Comments

Fraenkel (2010) called these the "vile" numbers.
Minimal with respect to property that parity of number of 1's in binary expansion alternates.
Minimal with respect to property that sequence is half its complement. [Corrected by Aviezri S. Fraenkel, Jan 29 2010]
If k appears then 2k does not.
Increasing sequence of positive integers k such that A035263(k)=1 (from paper by Allouche et al.). - Emeric Deutsch, Jan 15 2003
a(n) is an odious number (see A000069) for n odd; a(n) is an evil number (see A001969) for n even. - Philippe Deléham, Mar 16 2004
Indices of odd numbers in A007913, in A001511. - Philippe Deléham, Mar 27 2004
Partial sums of A026465. - Paul Barry, Dec 09 2004
A121701(2*a(n)) = A121701(a(n)); A096268(a(n)-1) = 0. - Reinhard Zumkeller, Aug 16 2006
A different permutation of the same terms may be found in A141290 and the accompanying array. - Gary W. Adamson, Jun 14 2008
a(n) = n-th clockwise Tower of Hanoi move; counterclockwise if not in the sequence. - Gary W. Adamson, Jun 14 2008
Indices of terms of Thue-Morse sequence A010060 which are different from the previous term. - Tanya Khovanova, Jan 06 2009
The sequence has the following fractal property. Remove the odd numbers from the sequence, leaving 4,12,16,20,28,36,44,48,52,... Dividing these terms by 4 we get 1,3,4,5,7,9,11,12,..., which is the original sequence back again. - Benoit Cloitre, Apr 06 2010
From Gary W. Adamson, Mar 21 2010: (Start)
A conjectured identity relating to the partition sequence, A000041 as polcoeff p(x); A003159, and its characteristic function A035263: (1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, ...); and A036554 indicating n-th terms with zeros in A035263: (2, 6, 8, 10, 14, 18, 22, ...).
The conjecture states that p(x) = A(x) = A(x^2) when A(x) = polcoeff A174065 = the Euler transform of A035263 = 1/((1-x)*(1-x^3)*(1-x^4)*(1-x^5)*...) = 1 + x + x^2 + 2*x^3 + 3*x^4 + 4*x^5 + ... and the aerated variant = the Euler transform of the complement of A035263: 1/((1-x^2)*(1-x^6)*(1-x^8)*...) = 1 + x^2 + x^4 + 2*x^6 + 3*x^8 + 4*x^10 + ....
(End)
The conjecture above was proved by Jean-Paul Allouche on Dec 21 2013. - Gary W. Adamson, Jan 22 2014
If the lower s-Wythoff sequence of s is s, then s=A003159. (See A184117 for the definition of lower and upper s-Wythoff sequences.) Starting with any nondecreasing sequence s of positive integers, A003159 is the limit when the lower s-Wythoff operation is iterated. For example, starting with s=(1,4,9,16,...)=(n^2), we obtain lower and upper s-Wythoff sequences
a=(1,3,4,5,6,8,9,10,11,12,14,...)=A184427;
b=(2,7,12,21,31,44,58,74,...)=A184428.
Then putting s=a and repeating the operation gives a'=(1,3,4,5,7,9,11,12,14,...), which has the same first eight terms as A003159. - Clark Kimberling, Jan 14 2011

Examples

			1=1, 3=11, 5=101 and 7=111 have no (0 = even) trailing zeros, 4=100 has 2 (= even) trailing zeros in the base-2 representation.
2=10 and 6=110 end in one (=odd number) of trailing zeros in their base-2 representation, therefore are not terms of this sequence. - _M. F. Hasler_, Oct 29 2013
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

For the actual binary numbers see A280049.
Indices of even numbers in A007814.
Complement of A036554, also one-half of A036554.

Programs

  • Haskell
    import Data.List (delete)
    a003159 n = a003159_list !! (n-1)
    a003159_list = f [1..] where f (x:xs) = x : f (delete  (2*x) xs)
    -- Reinhard Zumkeller, Nov 04 2011
    
  • Maple
    filter:= n -> type(padic:-ordp(n,2),even):
    select(filter,[$1..1000]); # Robert Israel, Jul 07 2014
  • Mathematica
    f[n_Integer] := Block[{k = n, c = 0}, While[ EvenQ[k], c++; k /= 2]; c]; Select[ Range[105], EvenQ[ f[ # ]] & ]
    Select[Range[150],EvenQ[IntegerExponent[#,2]]&] (* Harvey P. Dale, Oct 19 2011 *)
  • PARI
    a(n)=if(n<2,n>0,n=a(n-1); until(valuation(n,2)%2==0,n++); n)
    
  • PARI
    is(n)=valuation(n,2)%2==0 \\ Charles R Greathouse IV, Sep 23 2012
    
  • Python
    from itertools import count, islice
    def A003159_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(n&-n).bit_length()&1,count(max(startvalue,1)))
    A003159_list = list(islice(A003159_gen(),30)) # Chai Wah Wu, Jul 11 2022
    
  • Python
    def A003159(n):
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1^1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Jan 29 2025

Formula

a(0) = 1; for n >= 0, a(n+1) = a(n) + 1 if (a(n) + 1)/2 is not already in the sequence, = a(n) + 2 otherwise.
Limit_{n->oo} a(n)/n = 3/2. - Benoit Cloitre, Jun 13 2002
More precisely, a(n) = 3*n/2 + O(log n). - Charles R Greathouse IV, Sep 23 2012
a(n) = Sum_{k = 1..n} A026465(k). - Benoit Cloitre, May 31 2003
a(n+1) = (if a(n) mod 4 = 3 then A007814(a(n) + 1) mod 2 else a(n) mod 2) + a(n) + 1; a(1) = 1. - Reinhard Zumkeller, Aug 03 2003
a(A003157(n)) is even. - Philippe Deléham, Feb 22 2004
Sequence consists of numbers of the form 4^i*(2*j + 1), i>=0, j>=0. - Jon Perry, Jun 06 2004
G.f.: (1/(1-x)) * Product_{k >= 1} (1 + x^A001045(k)). - Paul Barry, Dec 09 2004
a(1) = 1, a(2) = 3, and for n >= 2 we get a(n+1) = 4 + a(n) + a(n-1) - a(a(n)-n+1) - a(a(n-1)-n+2). - Benoit Cloitre, Apr 08 2010
If A(x) is the counting function for a(n) <= x, then A(2^n) = (2^(n+1) + (-1)^n)/3. - Vladimir Shevelev, Apr 15 2010
a(n) = A121539(n) + 1. - Reinhard Zumkeller, Mar 01 2012
A003159 = { N | A007814(N) is even }. - M. F. Hasler, Oct 29 2013

Extensions

Additional comments from Michael Somos
Edited by M. F. Hasler, Oct 29 2013
Incorrect formula removed by Peter Munn, Dec 04 2020

A035263 Trajectory of 1 under the morphism 0 -> 11, 1 -> 10; parity of 2-adic valuation of 2n: a(n) = A000035(A001511(n)).

Original entry on oeis.org

1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1
Offset: 1

Views

Author

Keywords

Comments

First Feigenbaum symbolic (or period-doubling) sequence, corresponding to the accumulation point of the 2^{k} cycles through successive bifurcations.
To construct the sequence: start with 1 and concatenate: 1,1, then change the last term (1->0; 0->1) gives: 1,0. Concatenate those 2 terms: 1,0,1,0, change the last term: 1,0,1,1. Concatenate those 4 terms: 1,0,1,1,1,0,1,1 change the last term: 1,0,1,1,1,0,1,0, etc. - Benoit Cloitre, Dec 17 2002
Let T denote the present sequence. Here is another way to construct T. Start with the sequence S = 1,0,1,,1,0,1,,1,0,1,,1,0,1,,... and fill in the successive holes with the successive terms of the sequence T (from paper by Allouche et al.). - Emeric Deutsch, Jan 08 2003 [Note that if we fill in the holes with the terms of S itself, we get A141260. - N. J. A. Sloane, Jan 14 2009]
From N. J. A. Sloane, Feb 27 2009: (Start)
In more detail: define S to be 1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1,0,1___...
If we fill the holes with S we get A141260:
1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0,
........1.........0.........1.........1.........0.......1.........1.........0...
- the result is
1..0..1.1.1..0..1.0.1..0..1.1.1..0..1.1.1..0..1.0.1.... = A141260.
But instead, if we define T recursively by filling the holes in S with the terms of T itself, we get A035263:
1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0, 1___1, 0,
........1.........0.........1.........1.........1.......0.........1.........0...
- the result is
1..0..1.1.1..0..1.0.1..0..1.1.1..0..1.1.1..0..1.1.1.0.1.0.1..0..1.1.1..0..1.0.1.. = A035263. (End)
Characteristic function of A003159, i.e., A035263(n)=1 if n is in A003159 and A035263(n)=0 otherwise (from paper by Allouche et al.). - Emeric Deutsch, Jan 15 2003
This is the sequence of R (=1), L (=0) moves in the Towers of Hanoi puzzle: R, L, R, R, R, L, R, L, R, L, R, R, R, ... - Gary W. Adamson, Sep 21 2003
Manfred Schroeder, p. 279 states, "... the kneading sequences for unimodal maps in the binary notation, 0, 1, 0, 1, 1, 1, 0, 1..., are obtained from the Morse-Thue sequence by taking sums mod 2 of adjacent elements." On p. 278, in the chapter "Self-Similarity in the Logistic Parabola", he writes, "Is there a closer connection between the Morse-Thue sequence and the symbolic dynamics of the superstable orbits? There is indeed. To see this, let us replace R by 1 and C and L by 0." - Gary W. Adamson, Sep 21 2003
Partial sums modulo 2 of the sequence 1, a(1), a(1), a(2), a(2), a(3), a(3), a(4), a(4), a(5), a(5), a(6), a(6), ... . - Philippe Deléham, Jan 02 2004
Parity of A007913, A065882 and A065883. - Philippe Deléham, Mar 28 2004
The length of n-th run of 1's in this sequence is A080426(n). - Philippe Deléham, Apr 19 2004
Also parity of A005043, A005773, A026378, A104455, A117641. - Philippe Deléham, Apr 28 2007
Equals parity of the Towers of Hanoi, or ruler sequence (A001511), where the Towers of Hanoi sequence (1, 2, 1, 3, 1, 2, 1, 4, ...) denotes the disc moved, labeled (1, 2, 3, ...) starting from the top; and the parity of (1, 2, 1, 3, ...) denotes the direction of the move, CW or CCW. The frequency of CW moves converges to 2/3. - Gary W. Adamson, May 11 2007
A conjectured identity relating to the partition sequence, A000041: p(x) = A(x) * A(x^2) when A(x) = the Euler transform of A035263 = polcoeff A174065: (1 + x + x^2 + 2x^3 + 3x^4 + 4x^5 + ...). - Gary W. Adamson, Mar 21 2010
a(n) is 1 if the number of trailing zeros in the binary representation of n is even. - Ralf Stephan, Aug 22 2013
From Gary W. Adamson, Mar 25 2015: (Start)
A conjectured identity relating to the partition sequence, A000041 as polcoeff p(x); A003159, and its characteristic function A035263: (1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, ...); and A036554 indicating n-th terms with zeros in A035263: (2, 6, 8, 10, 14, 18, 22, ...).
The conjecture states that p(x) = A(x) = A(x^2) when A(x) = polcoeffA174065 = the Euler transform of A035263 = 1/(1-x)*(1-x^3)*(1-x^4)*(1-x^5)*... = (1 + x + x^2 + 2x^3 + 3x^4 + 4x^5 + ...) and the aerated variant = the Euler transform of the complement of A035263: 1/(1-x^2)*(1-x^6)*(1-x^8)*... = (1 + x^2 + x^4 + 2x^6 + 3x^8 + 4x^10 + ...).
(End)
The conjecture above was proved by Jean-Paul Allouche on Dec 21 2013.
Regarded as a column vector, this sequence is the product of A047999 (Sierpinski's gasket) regarded as an infinite lower triangular matrix and A036497 (the Fredholm-Rueppel sequence) where the 1's have alternating signs, 1, -1, 0, 1, 0, 0, 0, -1, .... - Gary W. Adamson, Jun 02 2021
The numbers of 1's through n (A050292) can be determined by starting with the binary (say for 19 = 1 0 0 1 1) and writing: next term is twice current term if 0, otherwise twice plus 1. The result is 1, 2, 4, 9, 19. Take the difference row, = 1, 1, 2, 5, 10; and add the odd-indexed terms from the right: 5, 4, 3, 2, 1 = 10 + 2 + 1 = 13. The algorithm is the basis for determining the disc configurations in the tower of Hanoi game, as shown in the Jul 24 2021 comment of A060572. - Gary W. Adamson, Jul 28 2021

References

  • Karamanos, Kostas. "From symbolic dynamics to a digital approach." International Journal of Bifurcation and Chaos 11.06 (2001): 1683-1694. (Full version. See p. 1685)
  • Karamanos, K. (2000). From symbolic dynamics to a digital approach: chaos and transcendence. In Michel Planat (Ed.), Noise, Oscillators and Algebraic Randomness (Lecture Notes in Physics, pp. 357-371). Springer, Berlin, Heidelberg. (Short version. See p. 359)
  • Manfred R. Schroeder, "Fractals, Chaos, Power Laws", W. H. Freeman, 1991
  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 892, column 2, Note on p. 84, part (a).

Crossrefs

Parity of A001511. Anti-parity of A007814.
Absolute values of first differences of A010060. Apart from signs, same as A029883. Essentially the same as A056832.
Swapping 0 and 1 gives A096268.
Cf. A033485, A050292 (partial sums), A089608, A088172, A019300, A039982, A073675, A121701, A141260, A000041, A174065, A220466, A154269 (Mobius transform).
Limit of A317957(n) for large n.

Programs

  • Haskell
    import Data.Bits (xor)
    a035263 n = a035263_list !! (n-1)
    a035263_list = zipWith xor a010060_list $ tail a010060_list
    -- Reinhard Zumkeller, Mar 01 2012
    
  • Maple
    nmax:=105: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := (p+1) mod 2 od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Feb 07 2013
    A035263 := n -> 1 - padic[ordp](n, 2) mod 2:
    seq(A035263(n), n=1..105); # Peter Luschny, Oct 02 2018
  • Mathematica
    a[n_] := a[n] = If[ EvenQ[n], 1 - a[n/2], 1]; Table[ a[n], {n, 1, 105}] (* Or *)
    Rest[ CoefficientList[ Series[ Sum[ x^(2^k)/(1 + (-1)^k*x^(2^k)), {k, 0, 20}], {x, 0, 105}], x]]
    f[1] := True; f[x_] := Xor[f[x - 1], f[Floor[x/2]]]; a[x_] := Boole[f[x]] (* Ben Branman, Oct 04 2010 *)
    a[n_] := If[n == 0, 0, 1 - Mod[ IntegerExponent[n, 2], 2]]; (* Jean-François Alcover, Jul 19 2013, after Michael Somos *)
    Nest[ Flatten[# /. {0 -> {1, 1}, 1 -> {1, 0}}] &, {0}, 7] (* Robert G. Wilson v, Jul 23 2014 *)
    SubstitutionSystem[{0->{1,1},1->{1,0}},1,{7}][[1]] (* Harvey P. Dale, Jun 06 2022 *)
  • PARI
    {a(n) = if( n==0, 0, 1 - valuation(n, 2)%2)}; /* Michael Somos, Sep 04 2006 */
    
  • PARI
    {a(n) = if( n==0, 0, n = abs(n); subst( Pol(binary(n)) - Pol(binary(n-1)), x, 1)%2)}; /* Michael Somos, Sep 04 2006 */
    
  • PARI
    {a(n) = if( n==0, 0, n = abs(n); direuler(p=2, n, 1 / (1 - X^((p<3) + 1)))[n])}; /* Michael Somos, Sep 04 2006 */
    
  • Python
    def A035263(n): return (n&-n).bit_length()&1 # Chai Wah Wu, Jan 09 2023
  • Scheme
    (define (A035263 n) (let loop ((n n) (i 1)) (cond ((odd? n) (modulo i 2)) (else (loop (/ n 2) (+ 1 i)))))) ;; (Use mod instead of modulo in R6RS) Antti Karttunen, Sep 11 2017
    

Formula

Absolute values of first differences (A029883) of Thue-Morse sequence (A001285 or A010060). Self-similar under 10->1 and 11->0.
Series expansion: (1/x) * Sum_{i>=0} (-1)^(i+1)*x^(2^i)/(x^(2^i)-1). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 17 2003
a(n) = Sum_{k>=0} (-1)^k*(floor((n+1)/2^k)-floor(n/2^k)). - Benoit Cloitre, Jun 03 2003
Another g.f.: Sum_{k>=0} x^(2^k)/(1+(-1)^k*x^(2^k)). - Ralf Stephan, Jun 13 2003
a(2*n) = 1-a(n), a(2*n+1) = 1. - Ralf Stephan, Jun 13 2003
a(n) = parity of A033485(n). - Philippe Deléham, Aug 13 2003
Equals A088172 mod 2, where A088172 = 1, 2, 3, 7, 13, 26, 53, 106, 211, 422, 845, ... (first differences of A019300). - Gary W. Adamson, Sep 21 2003
a(n) = a(n-1) - (-1)^n*a(floor(n/2)). - Benoit Cloitre, Dec 02 2003
a(1) = 1 and a(n) = abs(a(n-1) - a(floor(n/2))). - Benoit Cloitre, Dec 02 2003
a(n) = 1 - A096268(n+1); A050292 gives partial sums. - Reinhard Zumkeller, Aug 16 2006
Multiplicative with a(2^k) = 1 - (k mod 2), a(p^k) = 1, p > 2. Dirichlet g.f.: Product_{n = 4 or an odd prime} (1/(1-1/n^s)). - Christian G. Bower, May 18 2005
a(-n) = a(n). a(0)=0. - Michael Somos, Sep 04 2006
Dirichlet g.f.: zeta(s)*2^s/(2^s+1). - Ralf Stephan, Jun 17 2007
a(n+1) = a(n) XOR a(ceiling(n/2)), a(1) = 1. - Reinhard Zumkeller, Jun 11 2009
Let D(x) be the generating function, then D(x) + D(x^2) == x/(1-x). - Joerg Arndt, May 11 2010
a(n) = A010060(n) XOR A010060(n+1); a(A079523(n)) = 0; a(A121539(n)) = 1. - Reinhard Zumkeller, Mar 01 2012
a((2*n-1)*2^p) = (p+1) mod 2, p >= 0 and n >= 1. - Johannes W. Meijer, Feb 07 2013
a(n) = A000035(A001511(n)). - Omar E. Pol, Oct 29 2013
a(n) = 2-A056832(n) = (5-A089608(n))/4. - Antti Karttunen, Sep 11 2017, after Benoit Cloitre
For n >= 0, a(n+1) = M(2n) mod 2 where M(n) is the Motzkin number A001006 (see Deutsch and Sagan 2006 link). - David Callan, Oct 02 2018
a(n) = A038712(n) mod 3. - Kevin Ryde, Jul 11 2019
Given any n in the form (k * 2^m, k odd), extract k and m. Categorize the results into two outcomes of (k, m, even or odd). If (k, m) is (odd, even) substitute 1. If (odd, odd), denote the result 0. Example: 5 = (5 * 2^0), (odd, even, = 1). (6 = 3 * 2^1), (odd, odd, = 0). - Gary W. Adamson, Jun 23 2021

Extensions

Alternative description added to the name by Antti Karttunen, Sep 11 2017

A001285 Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 1 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 1's and 2's.

Original entry on oeis.org

1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 1
Offset: 0

Views

Author

Keywords

Comments

Or, follow a(0), ..., a(2^k-1) by its complement.
Equals limiting row of A161175. - Gary W. Adamson, Jun 05 2009
Parse A010060 into consecutive pairs: (01, 10, 10, 01, 10, 01, ...); then apply the rules: (01 -> 1; 10 ->2), obtaining (1, 2, 2, 1, 2, 1, 1, ...). - Gary W. Adamson, Oct 25 2010

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 15.
  • G. Everest, A. van der Poorten, I. Shparlinski and T. Ward, Recurrence Sequences, Amer. Math. Soc., 2003; see esp. p. 255.
  • W. H. Gottschalk and G. A. Hedlund, Topological Dynamics. American Mathematical Society, Colloquium Publications, Vol. 36, Providence, RI, 1955, p. 105.
  • M. Lothaire, Combinatorics on Words. Addison-Wesley, Reading, MA, 1983, p. 23.
  • A. Salomaa, Jewels of Formal Language Theory. Computer Science Press, Rockville, MD, 1981, p. 6.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A010060 for 0, 1 version, which is really the main entry for this sequence; also A003159. A225186 (squares).
A026465 gives run lengths.
Cf. A010059 (1, 0 version).
Cf. A161175. - Gary W. Adamson, Jun 05 2009
Cf. A026430 (partial sums).
Boustrophedon transforms: A230958, A029885.

Programs

  • Haskell
    a001285 n = a001285_list !! n
    a001285_list = map (+ 1) a010060_list
    -- Reinhard Zumkeller, Oct 03 2012
    
  • Maple
    A001285 := proc(n) option remember; if n=0 then 1 elif n mod 2 = 0 then A001285(n/2) else 3-A001285((n-1)/2); fi; end;
    s := proc(k) local i, ans; ans := [ 1,2 ]; for i from 0 to k do ans := [ op(ans),op(map(n->if n=1 then 2 else 1 fi, ans)) ] od; RETURN(ans); end; t1 := s(6); A001285 := n->t1[n]; # s(k) gives first 2^(k+2) terms
  • Mathematica
    Nest[ Flatten@ Join[#, # /. {1 -> 2, 2 -> 1}] &, {1}, 7] (* Robert G. Wilson v, Feb 26 2005 *)
    a[n_] := Mod[Sum[Mod[Binomial[n, k], 2], {k, 0, n}], 3]; Table[a[n], {n, 0, 101}] (* Jean-François Alcover, Jul 02 2019 *)
    ThueMorse[Range[0,120]]+1 (* Harvey P. Dale, May 07 2021 *)
  • PARI
    a(n)=1+subst(Pol(binary(n)),x,1)%2
    
  • PARI
    a(n)=sum(k=0,n,binomial(n,k)%2)%3
    
  • PARI
    a(n)=hammingweight(n)%2+1 \\ Charles R Greathouse IV, Mar 26 2013
    
  • Python
    from itertools import islice
    def A001285_gen(): # generator of terms
        yield 1
        blist = [1]
        while True:
            c = [3-d for d in blist]
            blist += c
            yield from c
    A001285_list = list(islice(A001285_gen(),30)) # Chai Wah Wu, Nov 13 2022
    
  • Python
    def A001285(n): return 2 if n.bit_count()&1 else 1 # Chai Wah Wu, Mar 01 2023

Formula

a(2n) = a(n), a(2n+1) = 3 - a(n), a(0) = 1. Also, a(k+2^m) = 3 - a(k) if 0 <= k < 2^m.
a(n) = 1 + A010060(n).
a(n) = 2 - A010059(n) = 1/2*(3 - (-1)^A000120(n)). - Ralf Stephan, Jun 20 2003
a(n) = (Sum{k=0..n} binomial(n, k) mod 2) mod 3 = A001316(n) mod 3. - Benoit Cloitre, May 09 2004
G.f.: (3/(1 - x) - Product_{k>=0} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019

A050292 a(2n) = 2n - a(n), a(2n+1) = 2n + 1 - a(n) (for n >= 0).

Original entry on oeis.org

0, 1, 1, 2, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 21, 21, 22, 22, 23, 24, 25, 25, 26, 26, 27, 27, 28, 29, 30, 30, 31, 32, 33, 33, 34, 35, 36, 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 47, 47, 48, 48, 49, 49, 50, 51, 52, 52, 53, 54
Offset: 0

Views

Author

Keywords

Comments

Note that the first equation implies a(0)=0, so there is no need to specify an initial value.
Maximal cardinality of a double-free subset of {1, 2, ..., n}, or in other words, maximal size of a subset S of {1, 2, ..., n} with the property that if x is in S then 2x is not. a(0)=0 by convention.
Least k such that a(k)=n is equal to A003159(n).
To construct the sequence: let [a, b, c, a, a, a, b, c, a, b, c, ...] be the fixed point of the morphism a -> abc, b ->a, c -> a, starting from a(1) = a, then write the indices of a, b, c, that of a being written twice; see A092606. - Philippe Deléham, Apr 13 2004
Number of integers from {1,...,n} for which the subtraction of 1 changes the parity of the number of 1's in their binary expansion. - Vladimir Shevelev, Apr 15 2010
Number of integers from {1,...,n} the factorization of which over different terms of A050376 does not contain 2. - Vladimir Shevelev, Apr 16 2010
a(n) modulo 2 is the Prouhet-Thue-Morse sequence A010060. Each number n appears A026465(n+1) times. - Philippe Deléham, Oct 19 2011
Another way of stating the last two comments from Philippe Deléham: the sequence can be obtained by replacing each term of the Thue-Morse sequence A010060 by the run number that term is in. - N. J. A. Sloane, Dec 31 2013

Examples

			Examples for n = 1 through 8: {1}, {1}, {1,3}, {1,3,4}, {1,3,4,5}, {1,3,4,5}, {1,3,4,5,7}, {1,3,4,5,7}.
Binary expansion of 5 is 101, so Sum{i>=0} b_i*(-1)^i = 2. Therefore a(5) = 10/3 + 2/3 = 4. - _Vladimir Shevelev_, Apr 15 2010
		

References

  • S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.26.
  • Wang, E. T. H. "On Double-Free Sets of Integers." Ars Combin. 28, 97-100, 1989.

Crossrefs

Programs

  • Haskell
    a050292 n = a050292_list !! (n-1)
    a050292_list = scanl (+) 0 a035263_list
    -- Reinhard Zumkeller, Jan 21 2013
    
  • Maple
    A050292:=n->add((-1)^k*floor(n/2^k), k=0..n); seq(A050292(n), n=0..100); # Wesley Ivan Hurt, Feb 14 2014
  • Mathematica
    a[n_] := a[n] = If[n < 2, 1, n - a[Floor[n/2]]]; Table[ a[n], {n, 1, 75}]
    Join[{0},Accumulate[Nest[Flatten[#/.{0->{1,1},1->{1,0}}]&,{0},7]]] (* Harvey P. Dale, Apr 29 2018 *)
  • PARI
    a(n)=if(n<2,1,n-a(floor(n/2)))
    
  • Python
    from sympy.ntheory import digits
    def A050292(n): return ((n<<1)+sum((0,1,-1,0)[i] for i in digits(n,4)[1:]))//3 # Chai Wah Wu, Jan 30 2025

Formula

Partial sums of A035263. Close to (2/3)*n.
a(n) = A123087(2*n) = n - A123087(n). - Max Alekseyev, Mar 05 2023
From Benoit Cloitre, Nov 24 2002: (Start)
a(1)=1, a(n) = n - a(floor(n/2));
a(n) = (2/3)*n + (1/3)*A065359(n);
more generally, for m>=0, a(2^m*n) - 2^m*a(n) = A001045(m)*A065359(n) where A001045(m) = (2^m - (-1)^m)/3 is the Jacobsthal sequence;
a(A039004(n)) = (2/3)*A039004(n);
a(2*A039004(n)) = 2*a(A039004(n));
a(A003159(n)) = n;
a(A003159(n)-1) = n-1;
a(n) mod 2 = A010060(n) the Thue-Morse sequence;
a(n+1) - a(n) = A035263(n+1);
a(n+2) - a(n) = abs(A029884(n)).
(End)
G.f.: (1/(x-1)) * Sum_{i>=0} (-1)^i*x^(2^i)/(x^(2^i)-1). - Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 17 2003
a(n) = Sum_{k>=0} (-1)^k*floor(n/2^k). - Benoit Cloitre, Jun 03 2003
a(A091785(n)) = 2n; a(A091855(n)) = 2n-1. - Philippe Deléham, Mar 26 2004
a(2^n) = (2^(n+1) + (-1)^n)/3. - Vladimir Shevelev, Apr 15 2010
If n = Sum_{i>=0} b_i*2^i is the binary expansion of n, then a(n) = 2n/3 + (1/3)Sum_{i>=0} b_i*(-1)^i. Thus a(n) = 2n/3 + O(log(n)). - Vladimir Shevelev, Apr 15 2010
Moreover, the equation a(3m)=2m has infinitely many solutions, e.g., a(3*2^k)=2*2^k; on the other hand, a((4^k-1)/3)=(2*(4^k-1))/9+k/3, i.e., limsup |a(n)-2n/3| = infinity. - Vladimir Shevelev, Feb 23 2011
a(n) = Sum_{k>=0} A030308(n,k)*A001045(k+1). - Philippe Deléham, Oct 19 2011
From Peter Bala, Feb 02 2013: (Start)
Product_{n >= 1} (1 + x^((2^n - (-1)^n)/3 )) = (1 + x)^2(1 + x^3)(1 + x^5)(1 + x^11)(1 + x^21)... = 1 + sum {n >= 1} x^a(n) = 1 + 2x + x^2 + x^3 + 2x^4 + 2x^5 + .... Hence this sequence lists the numbers representable as a sum of distinct Jacobsthal numbers A001045 = [1, 1', 3, 5, 11, 21, ...], where we distinguish between the two occurrences of 1 by writing them as 1 and 1'. For example, 9 occurs twice in the present sequence because 9 = 5 + 3 + 1 and 9 = 5 + 3 + 1'. Cf. A197911 and A080277. See also A120385.
(End)

Extensions

Extended with formula by Christian G. Bower, Sep 15 1999
Corrected and extended by Reinhard Zumkeller, Aug 16 2006
Extended with formula by Philippe Deléham, Oct 19 2011
Entry revised to give a simpler definition by N. J. A. Sloane, Jan 03 2014

A003156 A self-generating sequence (see Comments for definition).

Original entry on oeis.org

1, 4, 5, 6, 9, 12, 15, 16, 17, 20, 21, 22, 25, 26, 27, 30, 33, 36, 37, 38, 41, 44, 47, 48, 49, 52, 55, 58, 59, 60, 63, 64, 65, 68, 69, 70, 73, 76, 79, 80, 81, 84, 85, 86, 89, 90, 91, 94, 97, 100, 101, 102, 105, 106, 107, 110, 111, 112, 115, 118, 121, 122, 123, 126, 129, 132
Offset: 1

Views

Author

Keywords

Comments

From N. J. A. Sloane, Dec 26 2020: (Start)
The best definitions of the triple [this sequence, A003157, A003158] are as the rows a(n), b(n), c(n) of the table:
n: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...
a: 1, 4, 5, 6, 9, 12, 15, 16, 17, 20, 21, 22, ...
b: 3, 8, 11, 14, 19, 24, 29, 32, 35, 40, 43, 46, ...
c: 2, 7, 10, 13, 18, 23, 28, 31, 34, 39, 42, 45, ...
where a(1)=1, b(1)=3, c(1)=2, and thereafter
a(n) = mex{a(i), b(i), c(i), i
b(n) = a(n) + 2*n,
c(n) = b(n) - 1.
Then a,b,c form a partition of the positive integers.
Note that there is another triple of sequences (A003144, A003145, A003146) also called a, b, c and also a partition of the positive integers, in a different paper by the same authors (Carlitz-Scovelle-Hoggatt) in the same volume of the same journal.
(End)
a(n) is the number of ones before the n-th zero in the Feigenbaum sequence A035263. - Philippe Deléham, Mar 27 2004
Number of odd numbers before the n-th even number in A007413, A007913, A001511, A029883, A033485, A035263, A036585, A065882, A065883, A088172, A092412. - Philippe Deléham, Apr 03 2004
Indices of a in the sequence closed under a -> abc, b -> a, c -> a, starting with a(1) = a; see A092606 where a = 0, b = 2, c = 1. - Philippe Deléham, Apr 12 2004

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Programs

  • Haskell
    following Deléham
    a003156 n = a003156_list !! (n-1)
    a003156_list = scanl1 (+) a080426_list
    -- Reinhard Zumkeller, Oct 27 2014
    
  • Maple
    a:= proc(n) global l; while nops(l) [1, 3$d, 1][], l) od; `if` (n=1, 1, a(n-1) +l[n]) end: l:= [1]: seq (a(n), n=1..80); # Alois P. Heinz, Oct 31 2009
  • Mathematica
    Position[Nest[Flatten[# /. {0 -> {0, 2, 1}, 1 -> {0}, 2 -> {0}}]&, {0}, 7], 0] // Flatten (* Jean-François Alcover, Mar 14 2014 *)
  • Python
    def A003156(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(f,n,n)-n # Chai Wah Wu, Jan 29 2025

Formula

a(n) = A079523(n) - n + 1 = A003157(n) - 2n = A003158(n) - 2n + 1. - Philippe Deléham, Feb 28 2004
a(n) = A036554(n) - n = A072939(n) - n - 1 = 2*A003159(n) - n. - Philippe Deléham, Apr 10 2004
a(n) = Sum_{k = 1..n} A080426(k). - Philippe Deléham, Apr 16 2004

Extensions

More terms from Alois P. Heinz, Oct 31 2009
Incorrect equation removed from formula by Peter Munn, Dec 11 2020

A080426 a(1)=1, a(2)=3; all terms are either 1 or 3; each run of 3's is followed by a run of two 1's; and a(n) is the length of the n-th run of 3's.

Original entry on oeis.org

1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 3, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 3, 3, 1, 1
Offset: 1

Author

John W. Layman, Feb 18 2003

Keywords

Comments

It appears that the sequence can be calculated by any of the following three methods: (1) Start with 1 and repeatedly replace (simultaneously) all 1's with 1,3,1 and all 3's with 1,3,3,3,1. [Equivalently, trajectory of 1 under the morphism 1 -> 1,3,1; 3 -> 1,3,3,3,1. - N. J. A. Sloane, Nov 03 2019] (2) a(n)= A026490(2n). (3) Replace each 2 in A026465 (run lengths in Thue-Morse) with 3.
Length of n-th run of 1's in the Feigenbaum sequence A035263 = 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, .... - Philippe Deléham, Apr 18 2004
Another construction. Let S_0 = 1, and let S_n be obtained by applying the morphism 1 -> 3, 3 -> 113 to S_{n-1}. The sequence is the concatenation S_0, S_1, S_2, ... - D. R. Hofstadter, Oct 23 2014
a(n+1) is the number of times n appears in A003160. - John Keith, Dec 31 2020

Crossrefs

Arises in the analysis of A075326, A249031 and A249032.

Programs

  • Haskell
    -- following Deléham
    import Data.List (group)
    a080426 n = a080426_list !! n
    a080426_list = map length $ filter ((== 1) . head) $ group a035263_list
    -- Reinhard Zumkeller, Oct 27 2014
    
  • Mathematica
    Position[ Nest[ Flatten[# /. {0 -> {0, 2, 1}, 1 -> {0}, 2 -> {0}}]&, {0}, 8], 0] // Flatten // Differences // Prepend[#, 1]& (* Jean-François Alcover, Mar 14 2014, after Philippe Deléham *)
    nsteps=7;Flatten[SubstitutionSystem[{1->{3},3->{1,1,3}},{1},nsteps]] (* Paolo Xausa, Aug 12 2022, using D. R. Hofstadter's construction *)
  • PARI
    A080426(nmax) = my(a=[1], s=[[1, 3, 1], [], [1, 3, 3, 3, 1]]); while(length(a)A080426(100) \\ Paolo Xausa, Sep 14 2022, using method (1) from comments
    
  • Python
    def A080426(nmax):
        a, s = "1", "".maketrans({"1":"131", "3":"13331"})
        while len(a) < nmax: a = a.translate(s)
        return list(map(int, a[:nmax]))
    print(A080426(100)) # Paolo Xausa, Aug 30 2022, using method (1) from comments
    
  • Python
    def A080426(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(lambda x:f(x)+n,n,n)-bisection(lambda x:f(x)+n-1,n-1,n-1)-1 # Chai Wah Wu, Jan 29 2025

Formula

a(1) = 1; for n>1, a(n) = A003156(n) - A003156(n-1). - Philippe Deléham, Apr 16 2004

A249034 Odd numbers missing from A171947.

Original entry on oeis.org

5, 13, 17, 21, 29, 37, 45, 49, 53, 61, 65, 69, 77, 81, 85, 93, 101, 109, 113, 117, 125, 133, 141, 145, 149, 157, 165, 173, 177, 181, 189, 193, 197, 205, 209, 213, 221, 229, 237, 241, 245, 253, 257, 261, 269, 273, 277, 285, 293, 301, 305, 309, 317, 321, 325
Offset: 1

Author

N. J. A. Sloane, Oct 26 2014

Keywords

Comments

These are the odd terms in A171946.
Consider the sequence of first differences, divided by 4: 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, ... This is, almost certainly, A026465 without its leading 1. - N. J. A. Sloane, Oct 30 2014
This sequence appears to be the same as A260191, Numbers n such that there exists no square whose base-n digit sum is binomial(n,2), without that sequence's leading 3. - Jon E. Schoenfield, Jul 19 2015

Crossrefs

Programs

  • Haskell
    a249034 n = a249034_list !! (n-1)
    a249034_list = filter odd a171946_list
    -- Reinhard Zumkeller, Oct 26 2014
  • Mathematica
    f[n_] := Block[{a = {1}, b = {}, k}, Do[k = 2; While[MemberQ[a, k] || MemberQ[b, k], k++]; AppendTo[a, 2 k - 1]; AppendTo[b, k], {i, 2, n}]; a]; Complement[Range[1, Max@ #, 2], #] &@ f@ 120 (* Michael De Vlieger, Jul 20 2015 *)
Showing 1-10 of 22 results. Next