OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..20000 (first 1024 terms from Andrew Howroyd)
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)
(End)
Dirichlet g.f.: zeta(s)*(4^s+2^(s+1)+3)/(4^s+2^s+1). - Amiram Eldar, Dec 30 2022
EXAMPLE
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.
MATHEMATICA
a[n_] := Mod[IntegerExponent[n, 2], 3] + 1; Array[a, 100] (* Amiram Eldar, Oct 28 2022 *)
PROG
(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
(Magma) [Valuation(n, 2) mod 3 + 1: n in [1..100]]; // Vincenzo Librandi, Aug 01 2018
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
Benoit Cloitre, Dec 21 2002
STATUS
approved