%I #47 Dec 14 2023 05:12:35
%S 1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,
%T 3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,
%U 1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1,2,3,2,1
%N Period 4 sequence [ 1, 2, 3, 2, ...].
%C Continued fraction expansion of (2+sqrt(14))/4. - _Klaus Brockhaus_, May 01 2010
%C The sequence is like a sawtooth wave of period 4. - _Michael Somos_, Feb 13 2011
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1).
%F G.f.: (1 + 2*x + 3*x^2 + 2*x^3) / (1 - x^4).
%F Conjecture: a(n) = Sum_{k=0..n} e^(i*Pi*(A000120(A001045(n)) - A001045(A000120(n)))), i=sqrt(-1). - _Paul Barry_, Jan 14 2005
%F From _Paul Barry_, Jan 14 2005: (Start)
%F G.f.: (1 + x + 2x^2)/(1 - x + x^2 - x^3);
%F a(n) = 2 - cos(Pi*n/2). (End)
%F Moebius transform is length 4 sequence [2, 1, 0, -2]. - _Michael Somos_, Feb 13 2011
%F a(n) = 2 - A056594(n). - _Bruno Berselli_, Mar 10 2011
%F a(n) = a(-n) = a(n+4) for all n in Z. - _Michael Somos_, Apr 17 2015
%F 2 * a(n) = A164356(n) unless n=0. - _Michael Somos_, Apr 17 2015
%F G.f.: 1 / (1 - 2*x / (1 + x / (2 - 5*x / (1 + 16*x / (5 - x))))). - _Michael Somos_, Jan 20 2017
%F G.f.: 2 / (1 - x) - 1 / (1 + x^2). - _Michael Somos_, Jan 07 2019
%F a(n) = abs(((n+2) mod 4)-2) + 1. - _Daniel Jiménez_, Jan 14 2023
%e G.f. = 1 + 2*x + 3*x^2 + 2*x^3 + x^4 + 2*x^5 + 3*x^6 + 2*x^7 + x^8 + 2*x^9 + ...
%t CoefficientList[ Series[(1 + 2x + 3x^2 + 2x^3)/(1 - x^4), {x, 0, 85}], x]
%t a[ n_] := {2, 3, 2, 1}[[Mod[n, 4, 1]]]; (* _Michael Somos_, Apr 17 2015 *)
%t PadRight[{},120,{1,2,3,2}] (* _Harvey P. Dale_, Jun 13 2020 *)
%o (PARI) {a(n) = [1, 2, 3, 2] [n%4 + 1]}; /* _Michael Somos_, Feb 13 2011 */
%o (PARI) {a(n) = n%4 + 1 - 2 * (n%4 == 3)}; /* _Michael Somos_, Feb 13 2011 */
%o (PARI) {a(n) = 2 + kronecker( -4, n-1)}; /* _Michael Somos_, Feb 13 2011 */
%Y Cf. A000034, A000120, A001045, A028356, A164356.
%Y Cf. A177033 (decimal expansion of (2+sqrt(14))/4). - _Klaus Brockhaus_, May 01 2010
%K easy,nonn
%O 0,2
%A _Robert G. Wilson v_, Mar 01 2002