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.

A078734 Start with 1,2, concatenate 2^k previous terms and change last term as follows: 1->2, 2->3, 3->1.

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Dec 21 2002

Keywords

Examples

			Concatenating the first 2 terms 1,2 -> 1,2,1,2 and changing 2->3 gives the first 4 terms: 1,2,1,3.
Concatenating those first 4 terms ->1,2,1,3,1,2,1,3 and changing 3->1 gives the first 8 terms: 1,2,1,3,1,2,1,1.
		

Crossrefs

Programs

  • Magma
    [Valuation(n, 2) mod 3 + 1: n in [1..100]]; // Vincenzo Librandi, Aug 01 2018
  • Mathematica
    a[n_] := Mod[IntegerExponent[n, 2], 3] + 1; Array[a, 100] (* Amiram Eldar, Oct 28 2022 *)
  • PARI
    seq(n)={my(v=[1,2]); while(#v < n, v=concat(v,v); v[#v] = v[#v] % 3 + 1); vector(n, i, v[i])} \\ Andrew Howroyd, Jul 31 2018
    
  • PARI
    a(n) = valuation(n, 2) % 3 + 1; \\ Andrew Howroyd, Jul 31 2018
    

Formula

(Sum_{k=1..n} a(k))/n -> 1.57.... [This limit is the asymptotic mean of this sequence, 11/7. - Amiram Eldar, Oct 28 2022]
Multiplicative with a(2^e) = (e mod 3) + 1, a(p^e) = 1 for odd prime p. - Andrew Howroyd, Jul 31 2018
From Antti Karttunen, Dec 07 2021: (Start)
a(n) = 1 + A096271(n-1) = 1 + A010872(A007814(n)). [as above]
a(n) = A001511(A050985(n)).
(End)
Dirichlet g.f.: zeta(s)*(4^s+2^(s+1)+3)/(4^s+2^s+1). - Amiram Eldar, Dec 30 2022