login
Period 3: repeat [1, 4, 1].
5

%I #61 Dec 21 2023 17:00:22

%S 1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,

%T 4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,

%U 1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1,4,1,1

%N Period 3: repeat [1, 4, 1].

%C Continued fraction of (1 + sqrt(26))/5 = A188659.

%C Digital roots of the centered triangular numbers A005448. - _Ant King_, May 08 2012

%C Also the digital roots of centered 12-gonal numbers A003154. - _Peter M. Chema_, Dec 20 2023

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1).

%F a(n) = 4*(cos((2*n - 1)*Pi/3))^2 = 4 - 4*(sin((2*n - 1)*Pi/3))^2.

%F a(n+3) = a(n).

%F a(n) = 2 - cos(2*Pi*n/3) + sqrt(3)*sin(2*Pi*n/3).

%F O.g.f.: x*(1+4*x+x^2)/(1-x^3). [_Richard Choulet_, Nov 03 2008]

%F a(n) = 6 - a(n-1) - a(n-2) for n>2. - _Ant King_, Jun 12 2012

%F a(n) = (n mod 3)^(n mod 3). - _Bruno Berselli_, Jun 27 2016

%F a(n) = 1 + A021337(n) for n>0. - _Wesley Ivan Hurt_, Jul 01 2016

%p seq(op([1, 4, 1]), n=1..50); # _Wesley Ivan Hurt_, Jul 01 2016

%t Table[Round[N[4 (Cos[(2 n - 1) ArcTan[Sqrt[3]]])^2, 100]], {n, 1, 100}]

%t PadLeft[{},111,{1,4,1}] (* _Harvey P. Dale_, Sep 18 2011 *)

%o (PARI) a(n)=1+3*(n%3==2) \\ _Jaume Oliver Lafont_, Mar 24 2009

%o (Magma) &cat [[1,4,1]^^40]; // _Bruno Berselli_, Jun 27 2016

%Y Cf. A003154, A005448, A021337, A131534 (square roots), A188659.

%K nonn,easy

%O 1,2

%A _Artur Jasinski_, Oct 30 2008