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-7 of 7 results.

A187897 Rank transform of the sequence A159481; complement of A187898.

Original entry on oeis.org

1, 2, 3, 5, 6, 8, 10, 11, 12, 13, 15, 16, 18, 19, 20, 21, 22, 24, 25, 26, 28, 29, 30, 32, 34, 35, 36, 38, 39, 40, 42, 43, 44, 46, 47, 48, 50, 51, 52, 54, 56, 57, 58, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 74, 75, 76, 77, 79, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 94, 95, 96, 98, 100, 101, 102, 103, 104, 106, 108, 109, 111, 112, 113, 114, 115, 117, 119, 120, 121, 123, 124, 125
Offset: 1

Views

Author

Clark Kimberling, Mar 15 2011

Keywords

Comments

A187897 is the rank transform (see A187224) of the sequence of partial sums of the Thue-Morse sequence A010059.

Crossrefs

Programs

  • Mathematica
    t = Nest[Flatten[# /. {1 -> {1, 0}, 0 -> {0, 1}}] &, {1}, 8]; t
    seqA = Table[Sum[t[[k]], {k, 1, n}], {n, 1, 256}]   (* A159481 *)
    seqB = Table[n, {n, 1, 220}]; (* A000027 *)
    jointRank[{seqA_,
       seqB_}] := {Flatten@Position[#1, {_, 1}],
        Flatten@Position[#1, {_, 2}]} &[
      Sort@Flatten[{{#1, 1} & /@ seqA, {#1, 2} & /@ seqB}, 1]];
    limseqU =
    FixedPoint[jointRank[{seqA, #1[[1]]}] &, jointRank[{seqA, seqB}]][[
      1]]   (* A187897 *)
    Complement[Range[Length[seqA]], limseqU]  (* A187898 *)
    (* by Peter J. C. Moses,  Mar 15 2011 *)

A010059 Another version of the 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 0's and 1's.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Characteristic function of A001969 (evil numbers). - Ralf Stephan, Jun 20 2003
From Gary W. Adamson, Aug 24 2008: (Start)
Parity of A143579 (Odious numbers (A000069) interleaved with Evil numbers (A001969)).
Two conjectures: If n is even, the ratio of 1's to 0's = 1:1.
There are no three adjacent terms of the same parity. (End)
Conjecture (verified for the first 280000 entries): this is the characteristic function of A001969. - R. J. Mathar, Sep 05 2008
From Michel Dekking, Jan 05 2021: (Start)
Proof of these three conjectures: the first two follow directly from the third, because the sequence A010059 is the binary complement of the Thue-Morse sequence A010060.
For the third conjecture: the odious and evil numbers occur as quadruples EOOE and OEEO, simply by their definition. To obtain the mod 2 version of the interleave of the odious and evil numbers we therefore have to apply a transformation
EOOE -> OEOE, OEEO -> OEOE to these quadruples.
But this changes the parities from the corresponding 4n, 4n+1, 4n+2, 4n+3 quadruples from 0101 to 1001 in the first case, and from 0101 to 0110 in the second case. Since the quadruples EOOE and OEEO occur in a Thue Morse pattern, then also the quadruples 1001 and 0110 occur in a Thue Morse pattern, finishing the proof.
(End)

Examples

			The evolution starting at 1 is:
.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
...........
		

References

  • 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.

Crossrefs

Cf. A001285 (1, 2 version), A010060 (0, 1 version), A106400 (+1, -1 version), A059448 (with reversed subsections).
Cf. also A000069, A026147, A159481.

Programs

  • Haskell
    a010059 = (1 -) . a010060  -- Reinhard Zumkeller, Feb 04 2013
    
  • Maple
    A010059 := n->1-A010060(n);
    map(t->49-t,convert(StringTools[ThueMorse](1000),bytes)); # Robert Israel, Feb 02 2016
    # second Maple program:
    a := n -> ifelse(type(add(convert(n, base, 2)), even), 1, 0):
    seq(a(n), n = 0 .. 104); # Peter Luschny, Mar 11 2024
  • Mathematica
    Mod[ CoefficientList[Series[(1 + Sqrt[(1 - 3x)/(1 + x)])/(2(1 + x)), {x, 0, 111}], x], 2] (* Stephan Wolfram *)
    CoefficientList[ Series[1/(1 - x) + Product[1 - x^2^k, {k, 0, 10}], {x, 0, 111}]/2, x] (* Robert G. Wilson v, Jul 16 2004 *)
    Nest[ Flatten[ # /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {1}, 7] (* Robert G. Wilson v Sep 26 2006 *)
    od = Select[ Range[0, 129], OddQ@ DigitCount[ #, 2, 1] &]; ev = Select[ Range[0, 129], EvenQ@ DigitCount[ #, 2, 1] &]; Mod[ Flatten@ Transpose[{od, ev}], 2] (* Robert G. Wilson v, Apr 14 2009 *)
    Nest[ Join[ #, Mod[2# + 1, 3]] &, {1}, 7] (* Robert G. Wilson v, Jul 27 2014 *)
    {{1}}~Join~SubstitutionSystem[{0 -> {0, 1}, 1 -> {1, 0}}, {0}, 6] // Flatten (* Michael De Vlieger, Aug 15 2016, Version 10.2 *)
    1 - ThueMorse[Range[0, 100]] (* Paolo Xausa, Oct 25 2024 *)
  • PARI
    a(n)=!(hammingweight(n)%2); \\ Charles R Greathouse IV, Mar 29 2013
    
  • Python
    def A010059(n): return n.bit_count()&1^1 # Chai Wah Wu, Mar 01 2023
  • R
    maxrow <- 8 # by choice
    b01 <- 0
    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(1,b01))
    # Yosu Yurramendi, Apr 10 2017
    

Formula

G.f.: (1/2) * (1/(1-x) + Product_{k>=0} (1 - x^2^k)). - Ralf Stephan, Jun 20 2003
a(n) = A143579(n) mod 2. - Gary W. Adamson, Aug 24 2008
a(n) + A010060(n) = 1 for all n.
a(n) = A159481(n+1) - A159481(n). - Reinhard Zumkeller, Apr 16 2009
a(n) + A026147(n-1) = 2n for n >= 1. - Clark Kimberling, Oct 06 2014
a(n) = A000069(n+1) (mod 2). - John M. Campbell, Jun 30 2016
a(n) = A059448(A054429(n)) = (A106400(n)+1)/2 = (1+A008836(A005940(1+n)))/2. - Antti Karttunen, May 30 2017
If A(n)=(a(0),a(2),...,a(2^n-1)), then A(n+1)=(A(n),1-A(n)). - Arie Bos, Jul 27 2022
a(n) = (1 + (-1)^A000120(n))/2. - Lorenzo Sauras Altuzarra, Mar 10 2024

A007413 A squarefree (or Thue-Morse) ternary sequence: closed under 1->123, 2->13, 3->2. Start with 1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n)=2 if and only if n-1 is in A079523. - Benoit Cloitre, Mar 10 2003
Partial sums modulo 4 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, Mar 04 2004
To construct the sequence: start with 1 and concatenate 4 -1 = 3: 1, 3, then change the last term (2 -> 1, 3 ->2 ) gives 1, 2. Concatenate 1, 2 with 4 -1 = 3, 4 - 2 = 2: 1, 2, 3, 2 and change the last term: 1, 2, 3, 1. Concatenate 1, 2, 3, 1 with 4 - 1 = 3, 4 - 2 = 2, 4 - 3 = 1, 4 - 1 = 3: 1, 2, 3, 1, 3, 2, 1, 3 and change the last term: 1, 2, 3, 1, 3, 2, 1, 2 etc. - Philippe Deléham, Mar 04 2004
To construct the sequence: start with the Thue-Morse sequence A010060 = 0, 1, 1, 0, 1, 0, 0, 1, ... Then change 0 -> 1, 2, 3, and 1 -> 3, 2, 1, gives: 1, 2, 3, , 3, 2, 1, ,3, 2, 1, , 1, 2, 3, , 3, 2, 1, , ... and fill in the successive holes with the successive terms of the sequence itself. - _Philippe Deléham, Mar 04 2004
To construct the sequence: to insert the number 2 between the A003156(k)-th term and the (1 + A003156(k))-th term of the sequence 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, ... - Philippe Deléham, Mar 04 2004
Conjecture. The sequence is formed by the numbers of 1's between every pair of consecutive 2's in A076826. - Vladimir Shevelev, May 31 2009

Examples

			Here are the first 5 stages in the construction of this sequence, together with Mma code, taken from Keranen's article. His alphabet is a,b,c rather than 1,2,3.
productions = {"a" -> "abc ", "b" -> "ac ", "c" -> "b ", " " -> ""};
NestList[g, "a", 5] // TableForm
a
abc
abc ac b
abc ac b abc b ac
abc ac b abc b ac abc ac b ac abc b
abc ac b abc b ac abc ac b ac abc b abc ac b abc b ac abc b abc ac b ac
		

References

  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 18.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • A. Thue, Über unendliche Zeichenreihen, Norske Vid. Selsk. Skr. I. Mat. Nat. Kl. Christiania, No. 7 (1906), 1-22.

Crossrefs

First differences of A000069.
Equals A036580(n-1) + 1.

Programs

  • Mathematica
    Nest[ Flatten[ # /. {1 -> {1, 2, 3}, 2 -> {1, 3}, 3 -> {2}}] &, {1}, 7] (* Robert G. Wilson v, May 07 2005 *)
    2 - Differences[ThueMorse[Range[0, 100]]] (* Paolo Xausa, Oct 25 2024 *)
  • PARI
    {a(n) = if( n<1 || valuation(n, 2)%2, 2, 2 + (-1)^subst( Pol(binary(n)), x,1))};
    
  • Python
    def A007413(n): return 2-(n.bit_count()&1)+((n-1).bit_count()&1) # Chai Wah Wu, Mar 03 2023

Formula

a(n) modulo 2 = A035263(n). a(A036554(n)) = 2. a(A003159(n)) = 1 if n odd. a(A003159(n)) = 3 if n even. a(n) = A033485(n) mod 4. a(n) = 4 - A036585(n-1). - Philippe Deléham, Mar 04 2004
a(n) = 2 - A029883(n) = 3 - A036577(n). - Philippe Deléham, Mar 20 2004
For n>=1, we have: 1) a(A108269(n))=A010684(n-1); 2) a(A079523(n))=A010684(n-1); 3) a(A081706(2n))=A010684(n). - Vladimir Shevelev, Jun 22 2009

A115384 Partial sums of Thue-Morse numbers A010060.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 6, 7, 8, 8, 9, 9, 9, 10, 10, 11, 12, 12, 12, 13, 14, 14, 15, 15, 15, 16, 17, 17, 17, 18, 18, 19, 20, 20, 20, 21, 22, 22, 23, 23, 23, 24, 24, 25, 26, 26, 27, 27, 27, 28, 29, 29, 29, 30, 30, 31, 32, 32, 33, 33, 33, 34, 34, 35, 36, 36, 36, 37, 38, 38
Offset: 0

Views

Author

Paul Barry, Jan 21 2006

Keywords

Crossrefs

Programs

  • Mathematica
    Accumulate[Nest[Flatten[#/.{0->{0,1},1->{1,0}}]&,{0},7]] (* Peter J. C. Moses, Apr 15 2013 *)
    Accumulate[ThueMorse[Range[0,100]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 02 2017 *)
  • PARI
    a(n)=n\2 + (n%2 || hammingweight(n+1)%2==0) \\ Charles R Greathouse IV, Mar 22 2013
    
  • Python
    def A115384(n): return (n>>1)+(n&1|((n+1).bit_count()&1^1)) # Chai Wah Wu, Mar 01 2023

Formula

a(n) = Sum_{k=0..n} A010060(k)^2.
a(n+1) = A115382(2n, n).
a(n)/n -> 1/2; a(n) = number of odious numbers <= n, see A000069. - Reinhard Zumkeller, Aug 26 2007, corrected by M. F. Hasler, May 22 2017.
a(n) = Sum_{i=1..n} (S2(n) mod 2), where S2 = binary weight; lim a(n)/n = 1/2. More generally, consider a(n) = Sum_{i=1..n} (F(Sk(n)) mod m), where Sk(n) is sum of digits of n, n in base k; F(t) is an arithmetic function; m integer. How does lim a(n)/n depend on F(t)? - Ctibor O. Zizka, Feb 25 2008
a(n) = n + 1 - A159481(n). - Reinhard Zumkeller, Apr 16 2009
a(n) = floor((n+1)/2)+(1+(-1)^n)*(1-(-1)^A000120(n))/4. - Vladimir Shevelev, May 27 2009
G.f.: (1/(1 - x)^2 - Product_{k>=1} (1 - x^(2^k)))/2. - Ilya Gutkovskiy, Apr 03 2019
a(n) = A026430(n+1) - n - 1. - Michel Dekking, Sep 17 2019
a(2n+1) = n+1 (see Hassan Tarfaoui link, Concours Général 1990). - Bernard Schott, Jan 21 2022

Extensions

Edited by M. F. Hasler, May 22 2017

A366902 The number of exponentially evil divisors of n.

Original entry on oeis.org

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

Views

Author

Amiram Eldar, Oct 27 2023

Keywords

Comments

First differs from A050361 at n = 128.
The number of divisors of n that are exponentially evil numbers (A262675), i.e., numbers having only evil (A001969) exponents in their canonical prime factorization.
The sum of these divisors is A366904(n) and the largest of them is A366906(n).

Crossrefs

Programs

  • Mathematica
    f[p_, e_] := Floor[e/2] + If[OddQ[e] || OddQ[DigitCount[e + 1, 2, 1]], 1, 0]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100]
  • PARI
    s(n) = n\2 + (n%2 || hammingweight(n+1)%2); \\ after Charles R Greathouse IV at A159481
    a(n) = vecprod(apply(x -> s(x), factor(n)[, 2]));

Formula

Multiplicative with a(p^e) = A159481(e).
a(n) >= 1, with equality if and only if n is a cubefree number (A004709).
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Product_{p prime} Sum_{k>=1} 1/p^A262675(k) = 1.241359937856... .

A245710 Number of nonzero evil numbers <= n, see A001969.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 7, 7, 8, 9, 9, 10, 10, 10, 11, 12, 12, 12, 13, 13, 14, 15, 15, 15, 16, 17, 17, 18, 18, 18, 19, 20, 20, 20, 21, 21, 22, 23, 23, 24, 24, 24, 25, 25, 26, 27, 27, 27, 28, 29, 29, 30, 30, 30, 31, 31, 32, 33, 33, 34, 34, 34, 35, 36
Offset: 0

Views

Author

Antti Karttunen, Aug 18 2014

Keywords

Crossrefs

One less than A159481.

Programs

  • Mathematica
    Join[{0},Accumulate[Table[If[EvenQ[DigitCount[n,2,1]],1,0],{n,80}]]] (* Harvey P. Dale, Aug 01 2021 *)
  • Python
    def A245710(n): return (n+1>>1)-((n+1).bit_count()&1&(n+1)^1) # Chai Wah Wu, Mar 01 2023

Formula

a(0) = 0, and for n >= 1, a(n) = A010059(n) + a(n-1). [Partial sums of A010059, after ignoring the first one at zero].
a(n) = n - A115384(n).
a(n) = A159481(n)-1.

A076826 a(n) = 2*(Sum_{k=0..n} A010060(k)) - n, where A010060 is a Thue-Morse sequence.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Nov 24 2002

Keywords

Comments

Is there any interesting sequence b(n) such that b(n) mod 3 = a(n)?
Fixed point of the morphism 0->012; 1->1; 2->210 starting with a(0) = 0. - Philippe Deléham, Mar 14 2004

Crossrefs

Cf. A000069 (odious numbers), A001969 (evil numbers).

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 1, 2}, 1 -> {1}, 2 -> {2, 1, 0}}) ]}], {0}, 6] (* Robert G. Wilson v, Mar 03 2005 *)
    cnt=0; Join[{0}, Table[If[EvenQ[Count[IntegerDigits[n,2],1]], cnt--, cnt++ ]; cnt, {n,150}]] (* T. D. Noe, Jun 14 2007 *)
  • PARI
    a(n)=if(n<0,0,2*sum(k=1,n,subst(Pol(binary(k)),x,1)%2)-n)
    
  • PARI
    a(n)=if(n<1,0,if(n%2,1,if(n/2%2,2-a(n\4*2),a(n/2))))
    
  • Python
    def A076826(n): return 1 if n&1 else (n.bit_count()&1)<<1 # Chai Wah Wu, Mar 01 2023

Formula

a(2k+1) = 1, a(4k) = a(2k), a(4k+2) = 2-a(2k). - Michael Somos, Dec 04 2002
a(2n) = 2*A010060(n); a(2n+1) = 1. - Benoit Cloitre, Mar 08 2004
a(n) = 2*(A026430(n+1) - 1) mod 3. - Philippe Deléham, Mar 28 2004
a(n) = (number of odious numbers <= n) - (number of evil numbers <= n) for n>0. - T. D. Noe, Jun 14 2007
a(n) = 2*A115384(n) - n. - Vladimir Shevelev, May 31 2009
a(n) = 0 if n and A000120(n) are even; a(n) = 2 if n is even but A000120(n) is odd; a(n) = 1 if n is odd. - Vladimir Shevelev, May 31 2009
Showing 1-7 of 7 results.