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 67 results. Next

A026430 a(n) is the sum of first n terms of A001285 (Thue-Morse sequence).

Original entry on oeis.org

0, 1, 3, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 19, 21, 23, 24, 26, 27, 28, 30, 31, 33, 35, 36, 37, 39, 41, 42, 44, 45, 46, 48, 50, 51, 52, 54, 55, 57, 59, 60, 61, 63, 65, 66, 68, 69, 70, 72, 73, 75, 77, 78, 80, 81, 82, 84, 86, 87, 88, 90, 91, 93
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A001285, A356133 (complement).
Cf. A115384.

Programs

  • Haskell
    a026430 n = a026430_list !! n
    a026430_list = scanl (+) 0 a001285_list -- Reinhard Zumkeller, Jun 28 2013
    
  • Mathematica
    A001285 = Table[ Mod[ Sum[ Mod[ Binomial[n, k], 2], {k, 0, n}], 3], {n, 0, 61}]; Accumulate[A001285] (* Jean-François Alcover, Sep 25 2012 *)
    Join[{0}, Accumulate[1 + ThueMorse /@ Range[0, 100]]] (* Jean-François Alcover, Sep 18 2019, from version 10.2 *)
  • PARI
    first(n)=my(v=vector(n)); v[1]=1; for(k=2,n,v[k]=if(k%2,v[k\2+1]-v[k\2])+k\2*3); concat(0,v) \\ Charles R Greathouse IV, May 09 2016
    
  • Python
    from itertools import accumulate, islice
    def A026430_gen(): # generator of terms
        yield from (0,1)
        blist, s = [1], 1
        while True:
            c = [3-d for d in blist]
            blist += c
            yield from (s+d for d in accumulate(c))
            s += sum(c)
    A026430_list = list(islice(A026430_gen(),30)) # Chai Wah Wu, Feb 22 2023
    
  • Python
    def A026430(n): return n+(n-1>>1)+(n-1&1|(n.bit_count()&1^1)) # Chai Wah Wu, Mar 01 2023

Formula

a(0)=0, a(1)=1, a(2n) = 3n, a(2n+1) = -a(n) + a(n+1) + 3n. - Ralf Stephan, Oct 08 2003
G.f.: x*(3/(1 - x)^2 - Product_{k>=1} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019

A026465 Length of n-th run of identical symbols in the Thue-Morse sequence A010060 (or A001285).

Original entry on oeis.org

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

Views

Author

Keywords

Comments

It appears that the sequence can be calculated by any of the following methods:
(1) Start with 1 and repeatedly replace 1 with 1, 2, 1 and 2 with 1, 2, 2, 2, 1;
(2) a(1) = 1, all terms are either 1 or 2 and, for n > 0, a(n) = 1 if the length of the n-th run of 2's is 1; a(n) = 2 if the length of the n-th run of consecutive 2's is 3, with each run of 2's separated by a run of two 1's;
(3) replace each 3 in A080426 with 2. - John W. Layman, Feb 18 2003
Number of representations of n as a sum of Jacobsthal numbers (1 is allowed twice as a part). Partial sums are A003159. With interpolated zeros, g.f. is (Product_{k>=1} (1 + x^A078008(k)))/2. - Paul Barry, Dec 09 2004
In other words, the consecutive 0's or 1's in A010060 or A010059. - Robin D. Saunders (saunders_robin_d(AT)hotmail.com), Sep 06 2006
From Carlo Carminati, Feb 25 2011: (Start)
The sequence (starting with the second term) can also be calculated by the following method:
Apply repeatedly to the string S_0 = [2] the following algorithm: take a string S, double it, if the last figure is 1, just add the last figure to the previous one, if the last figure is greater than one, decrease it by one unit and concatenate a figure 1 at the end. (This algorithm is connected with the interpretation of the sequence as a continued fraction expansion.) (End)
This sequence, starting with the second term, happens to be the continued fraction expansion of the biggest cluster point of the set {x in [0,1]: F^k(x) >= x, for all k in N}, where F denotes the Farey map (see A187061). - Carlo Carminati, Feb 28 2011
Starting with the second term, the fixed point of the substitution 2 -> 211, 1 -> 2. - Carlo Carminati, Mar 03 2011
It appears that this sequence contains infinitely many distinct palindromic subsequences. - Alexander R. Povolotsky, Oct 30 2016
From Michel Dekking, Feb 13 2019: (Start)
Let tau defined by tau(0) = 01, tau(1) = 10 be the Thue-Morse morphism, with fixed point A010060. Consecutive runs in A010060 are 0, 11, 0, 1, 00, 1, 1, ..., which are coded by their lengths 1, 2, 1, 1, 2, ... Under tau^2 consecutive runs are mapped to consecutive runs:
tau^2(0) = 0110, tau^2(1) = 1001,
tau^2(00) = 01100110, tau^2(11) = 10011001.
The reason is that (by definition of a run!) runs of 0's and runs of 1's alternate in the sequence of runs, and this is inherited by the image of these runs under tau^2.
Under tau^2 the runs of length 1 are mapped to the sequence 1,2,1 of run lengths, and the runs of length 2 are mapped to the sequence 1,2,2,2,1 of run lengths. This proves John Layman's conjecture number (1): it follows that (a(n)) is fixed point of the morphism alpha
alpha: 1 -> 121, 2 -> 12221.
Since alpha(1) and alpha(2) are both palindromes, this also proves Alexander Povolotsky's conjecture.
(End)

Crossrefs

Cf. A010060, A001285, A101615, A026490 (run lengths).
A080426 is an essentially identical sequence with another set of constructions.
Cf. A104248 (bisection odious), A143331 (bisection evil), A003159 (partial sums).
Cf. A187061, A363361 (as continued fraction).

Programs

  • Haskell
    import Data.List (group)
    a026465 n = a026465_list !! (n-1)
    a026465_list = map length $ group a010060_list
    -- Reinhard Zumkeller, Jul 15 2014
    
  • Maple
    # From Carlo Carminati, Feb 25 2011:
    ## period-doubling routine:
    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
    # (except for the initial term):
    S:=[2]:
    for j from 1 to 10  do S:=double(S); od:
    S;
    # From N. J. A. Sloane, Dec 31 2013:
    S:=[b]; M:=14;
    for n from 1 to M do T:=subs({b=[b,a,a], a=[b]}, S);
        S := map(x->op(x),T); od:
    T:=subs({a=1,b=2},S): T:=[1,op(T)]: [seq(T[n],n=1..40)];
  • Mathematica
    Length /@ Split@ Nest[ Flatten@ Join[#, # /. {1 -> 2, 2 -> 1}] &, {1}, 7]
    NestList[ Flatten[# /. {1 -> {2}, 2 -> {1, 1, 2}}] &, {1}, 7] // Flatten (* Robert G. Wilson v, May 20 2014 *)
  • PARI
    \\ See links.
    
  • Python
    def A026465(n):
        if n==1: return 1
        def iterfun(f,n=0):
            m, k = n, f(n)
            while m != k: m, k = k, f(k)
            return m
        def f(x):
            c, s = 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
        return iterfun(lambda x:f(x)+n,n)-iterfun(lambda x:f(x)+n-1,n-1) # Chai Wah Wu, Jan 29 2025

Formula

a(1) = 1; for n > 1, a(n) = A003159(n) - A003159(n-1). - Benoit Cloitre, May 31 2003
G.f.: Product_{k>=1} (1 + x^A001045(k)). - Paul Barry, Dec 09 2004
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 3/2. - Amiram Eldar, Jan 16 2022

Extensions

Corrected and extended by John W. Layman, Feb 18 2003
Definition revised by N. J. A. Sloane, Dec 30 2013

A029883 First differences of Thue-Morse sequence A001285.

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

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Also first differences of {0,1} Thue-Morse sequence A010060.- N. J. A. Sloane, Jan 05 2021
Fixed point of the morphism a->abc, b->ac, c->b, with a = 1, b = 0, c = -1, starting with a(1) = 1. - Philippe Deléham
From Thomas Anton, Sep 22 2020: (Start)
This sequence, interpreted as an infinite word, is squarefree.
Let & represent concatenation. For a word w of integers, let -w be the same word with each symbol negated. Then, starting with the empty word, this sequence can be obtained by iteratively applying the transformation T(w) = w & 1 & -w & 0 & -w & -1 & w. (End)

Crossrefs

Apart from signs, same as A035263. Cf. A001285, A010060, A036554, A091785, A091855.
a(n+1) = A036577(n) - 1 = A036585(n) - 2.

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {1, -1}, 1 -> {1, 0, -1}, -1 -> {0}})]}], {1}, 7] (* Robert G. Wilson v, Feb 26 2005 *)
    ThueMorse /@ Range[0, 105] // Differences (* Jean-François Alcover, Oct 15 2019 *)
  • PARI
    a(n)=if(n<1||valuation(n,2)%2,0,-(-1)^subst(Pol(binary(n)),x,1)) /* Michael Somos, Jul 08 2004 */
    
  • PARI
    a(n)=hammingweight(n)%2-hammingweight(n-1)%2 \\ Charles R Greathouse IV, Mar 26 2013
    
  • Python
    def A029883(n): return (bin(n).count('1')&1)-(bin(n-1).count('1')&1) # Chai Wah Wu, Mar 03 2023

Formula

Recurrence: a(4*n) = a(n), a(4*n+1) = a(2*n+1), a(4*n+2) = 0, a(4*n+3) = -a(2*n+1), starting a(1) = 1.
a(n) = 2 - A007413(n). a(A036554(n)) = 0; a(A091785(n)) = -1; a(A091855(n)) = 1. - Philippe Deléham, Mar 20 2004
G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = -v+w+u^2-v^2+2*w^2-2*u*w. - Michael Somos, Jul 08 2004

Extensions

Edited by Ralf Stephan, Dec 09 2004

A026147 a(n) = position of n-th 1 in A001285 or A010059 (Thue-Morse sequence).

Original entry on oeis.org

1, 4, 6, 7, 10, 11, 13, 16, 18, 19, 21, 24, 25, 28, 30, 31, 34, 35, 37, 40, 41, 44, 46, 47, 49, 52, 54, 55, 58, 59, 61, 64, 66, 67, 69, 72, 73, 76, 78, 79, 81, 84, 86, 87, 90, 91, 93, 96, 97, 100, 102, 103, 106, 107, 109, 112, 114, 115, 117, 120, 121, 124, 126, 127, 130
Offset: 1

Views

Author

Keywords

Comments

Barbeau notes that if we let A = the first 2^k terms of this sequence and B = the first 2^k terms of A181155, then the two sets A and B have the same sum of powers for first up to the k-th power. I note it holds for 0th power also. - Michael Somos, Jun 09 2013

Examples

			Let k=2. Then A = {1,4,6,7} and B = {2,3,5,8} have the property that 1^0+4^0+6^0+7^0 = 2^0+3^0+5^0+8^0 = 4, 1^1+4^1+6^1+7^1 = 2^1+3^1+5^1+8^1 = 18, and 1^2+4^2+6^2+7^2 = 2^2+3^2+5^2+8^2 = 102. - _Michael Somos_, Jun 09 2013
		

References

  • Edward J. Barbeau, Power Play, MAA, 1997. See p. 104.

Crossrefs

Programs

  • Mathematica
    a[ n_] := If[ n < 1, 0, 2 n + Mod[ Total[ IntegerDigits[ n - 1, 2]], 2] - 1] (* Michael Somos, Jun 09 2013 *)
  • PARI
    a(n)=2*n+hammingweight(n-1)%2-1 \\ Charles R Greathouse IV, Mar 22 2013
    
  • PARI
    {a(n) = if( n<1, 0, 2*n + subst( Pol( binary( n-1)), x, 1)%2 - 1)} /* Michael Somos, Jun 09 2013 */
    
  • Python
    def A026147(n): return 1+((m:=n-1).bit_count()&1)+(m<<1) # Chai Wah Wu, Mar 03 2023

Formula

a(n) = 1+A001969(n).
a(n) = Sum_{k=0..2n} mod(-2 + Sum_{j=0..k} floor(C(k, j)/2), 3). - Paul Barry, Dec 24 2004
a(n) + A010059(n+1) = 2n + 2 for n >= 0. - Clark Kimberling, Oct 06 2014

A029886 Convolution of Thue-Morse sequence A001285 with itself.

Original entry on oeis.org

1, 4, 8, 10, 12, 14, 15, 16, 22, 24, 23, 26, 29, 30, 34, 40, 38, 40, 43, 42, 47, 50, 52, 56, 55, 56, 62, 66, 64, 70, 71, 64, 78, 80, 75, 82, 83, 82, 88, 96, 89, 92, 100, 98, 102, 106, 105, 104, 111, 112, 114, 122, 118, 122, 125, 120, 130, 136, 131, 130, 141, 134, 138, 160
Offset: 0

Views

Author

Keywords

Comments

Comment from Jeremy Gardiner, Dec 28 2008: The following sequences all appear to have the same parity: A003071, A029886, A061297, A092524, A093431, A102393, A104258, A122248, A128975.

Crossrefs

Cf. A001285.

Programs

  • Mathematica
    P[n_, x_] := (bb = IntegerDigits[n, 2]) . x^Range[Length[bb]-1, 0, -1];
    TM[n_] := 1 + Mod[P[n, 1], 2];
    a[n_] := Sum[TM[k] TM[n-k], {k, 0, n}];
    Table[a[n], {n, 0, 63}] (* Jean-François Alcover, Aug 31 2018 *)
  • PARI
    a(n)=sum(k=0,n,(1+subst(Pol(binary(k)),x,1)%2)*(1+subst(Pol(binary(n-k)),x,1)%2)) \\ Ralf Stephan, Aug 23 2013

Formula

G.f.: (1/4)*(3/(1 - x) - Product_{k>=0} (1 - x^(2^k)))^2. - Ilya Gutkovskiy, Apr 03 2019

A026492 a(n) = t(3n), where t = A001285 (Thue-Morse sequence).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

Extensions

Name and Pari adapted to match offset in A001285 by Sean A. Irvine, Oct 02 2019

A029885 Boustrophedon transform of 1 followed by Thue-Morse sequence A001285.

Original entry on oeis.org

1, 2, 5, 13, 34, 108, 415, 1841, 9381, 53733, 342086, 2395481, 18300250, 151453434, 1349856656, 12890177378, 131298281746, 1420980348324, 16283235530691, 196958363484995, 2507751773736087, 33526171616091612
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a029885 n = sum $ zipWith (*) (a109449_row n) (1 : map fromIntegral a001285_list)
    -- Reinhard Zumkeller, Nov 04 2013
  • Mathematica
    tm[n_] := Mod[Sum[Mod[Binomial[n, k], 2], {k, 0, n}], 3];
    T[n_, k_] := (n!/k!) SeriesCoefficient[(1 + Sin[x])/Cos[x], {x, 0, n - k}];
    a[n_] := Sum[T[n, k] If[k == 0, 1, tm[k - 1]], {k, 0, n}];
    Table[a[n], {n, 0, 21}] (* Jean-François Alcover, Jul 02 2019 *)

Extensions

Definition corrected by Reinhard Zumkeller, Nov 04 2013

A026498 a(n) = t(1+3n), where t = A001285 (Thue-Morse sequence).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

Extensions

Name and Pari adapted to match offset in A001285 by Sean A. Irvine, Oct 03 2019

A026513 a(n) = t(2+3n), where t = A001285 (Thue-Morse sequence).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Array[1 + Mod[DigitCount[3 # + 2, 2, 1], 2] &, 105, 0] (* Michael De Vlieger, Oct 06 2019 *)
    Table[ThueMorse[2+3n],{n,0,100}]+1 (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 29 2020 *)
  • PARI
    a(n)=1+hammingweight(3*n+2)%2 \\ Charles R Greathouse IV, May 09 2016

Extensions

Name and Pari adapted to match offset in A001285 by Sean A. Irvine, Oct 05 2019

A080814 Successive words in the formal D0L language that produces the Thue-Morse sequence A001285 (start with 1, map 1 -> 12, 2 -> 21).

Original entry on oeis.org

1, 12, 1221, 12212112, 1221211221121221, 12212112211212212112122112212112, 1221211221121221211212211221211221121221122121121221211221121221
Offset: 1

Views

Author

N. J. A. Sloane, Mar 26 2003

Keywords

References

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

Crossrefs

Cf. A001285 (which is the limiting word), A010060, A080815.

Programs

  • Mathematica
    Map[FromDigits,SubstitutionSystem[{1->{1,2},2->{2,1}},{1},7]] (* Paolo Xausa, Dec 24 2023 *)
Showing 1-10 of 67 results. Next