OFFSET
0,4
COMMENTS
From Klaus Brockhaus, May 30 2010: (Start)
Periodic sequence: Repeat [1, 1, 1, 3].
Continued fraction expansion of (9+sqrt(165))/14.
Decimal expansion of 371/3333. (End)
Final nonzero digit of n^n in base 4. - José María Grau Ribas, Jan 19 2012
LINKS
FORMULA
G.f.: (1+x+x^2+3*x^3)/(1-x^4); a(n) = 3/2-sin(Pi*n/2)-cos(Pi*n)/2.
From Klaus Brockhaus, May 30 2010: (Start)
a(n) = a(n-4) for n > 3; a(0) = a(1) = a(2) = 1, a(3) = 3.
a(n) = (3-(-1)^n+(1-(-1)^n)*i*i^n)/2 where i = sqrt(-1). (End)
a(n) = 1 + 2*0^mod(n+1, 4). - Wesley Ivan Hurt, Oct 23 2014
MAPLE
MATHEMATICA
f[n_] := Switch[Mod[n, 4], 0, 1, 1, 1, 2, 1, 3, 3]; Array[f, 105, 0] (* Robert G. Wilson v, Jan 23 2012 *)
PadRight[{}, 120, {1, 1, 1, 3}] (* Harvey P. Dale, Sep 03 2021 *)
PROG
(Magma) [1+2*0^((n+1) mod 4) : n in [0..100]]; // Wesley Ivan Hurt, Oct 23 2014
(PARI) a(n)=if(n%4==3, 3, 1) \\ Charles R Greathouse IV, Oct 07 2015
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Apr 02 2004
STATUS
approved