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

%I #31 Dec 12 2023 08:08:10

%S 2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,

%T 3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,

%U 2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2,2,1,3,2

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

%C Continued fraction expansion of (7+sqrt(93))/6. - _Klaus Brockhaus_, Apr 30 2010

%H Vesselin Dimitrov, <a href="http://www.thehcmr.org/issue1_2/problems_and_solutions.pdf">Problem S07 - 4 (Corrected).</a> Harvard College Mathematical Review, Vol. 1, No. 2, Fall 2007.

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

%F a(n) = a(n-4) for n>4. G.f.: x*(2*x^3+3*x^2+x+2) / ((1-x)*(x+1)*(x^2+1)). - _Colin Barker_, Jun 20 2014

%F a(n) = 2-(-1)^n/2+(-1)^ceiling(n/2)/2. - _Wesley Ivan Hurt_, Jun 23 2014

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

%p A157810:=n->2 - (-1)^n/2 + (-1)^ceil(n/2)/2; seq(A157810(n), n=1..100); # _Wesley Ivan Hurt_, Jun 23 2014

%t ContinuedFraction[(7+Sqrt[93])/6,100] (* _Harvey P. Dale_, Jun 28 2012 *)

%t CoefficientList[Series[-(2*x^3 + 3*x^2 + x + 2)/((x - 1)*(x + 1)*(x^2 + 1)), {x, 0, 60}], x] (* _Wesley Ivan Hurt_, Jun 22 2014 *)

%o (PARI) Vec(-x*(2*x^3+3*x^2+x+2)/((x-1)*(x+1)*(x^2+1)) + O(x^100)) \\ _Colin Barker_, Jun 20 2014

%o (Magma) [2 - (-1)^n/2 + (-1)^Ceiling(n/2)/2 : n in [1..100]]; // _Wesley Ivan Hurt_, Jun 23 2014

%Y Cf. A001220.

%K nonn,easy

%O 1,1

%A _Jonathan Vos Post_, Mar 07 2009

%E Simpler definition from _Wesley Ivan Hurt_, Jul 07 2014