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.

A096271 Ternary sequence that is a fixed point of the morphism 0 -> 01, 1 -> 02, 2 -> 00.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 23 2004

Keywords

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 1}, 1 -> {0, 2}, 2 -> {0, 0}})]}], {0}, 7] (* Robert G. Wilson v, Feb 26 2005 *)
  • PARI
    map(d)=if(d==2,[0,0],if(d==1,[0,2],[0,1]))
    {m=53;v=[];w=[0];while(v!=w,v=w;w=[];for(n=1,min(m,length(v)),w=concat(w,map(v[n]))));for(n=1,2*m,print1(v[n],","))} \\ Klaus Brockhaus, Jun 23 2004
    
  • PARI
    A096271(n) = if(!(n%2),0,(1+A096271((n-1)/2))%3); \\ Antti Karttunen, Nov 01 2018
    
  • Python
    def A096271(n): return (~(n+1) & n).bit_length()%3 # Chai Wah Wu, Jan 09 2023

Formula

Recurrence: a(2n) = 0, a(2n+1) = (a(n)+1) mod 3. - Ralf Stephan, Dec 11 2004
a(n) = A007814(n+1) mod 3. - Gabriele Fici, Mar 28 2019
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 4/7. - Amiram Eldar, Jan 11 2023

Extensions

More terms from Klaus Brockhaus, Jun 23 2004