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

%I #27 Aug 31 2024 08:33:19

%S 1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,

%T 5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,

%U 1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1,3,5,3,1

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

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

%F G.f.: x * (3*x^2+2*x+1) / (1-x+x^2-x^3). [Corrected by _Georg Fischer_, May 19 2019]

%F a(n) = a(n-1) - a(n-2) + a(n-3) with a(1)=1, a(2)=3 and a(3)=5.

%F a(2n) = 3, a(4*n+1) = 1 and a(4*n+3) = 5.

%F a(n) = ((n+3) mod 4) + ((n+4) mod 4). - _Aaron J Grech_, Aug 30 2024

%t PadRight[{}, 105, {1, 3, 5, 3}] (* or *)

%t f[n_] := Switch[Mod[n, 4], 0, 3, 1, 1, 2, 3, 3, 5]; Array[f, 105] (* or *)

%t CoefficientList[ Series[(3x^2 +2x +1)/(-x^3 +x^2 -x +1), {x, 0, 104}], x] (* or *)

%t LinearRecurrence[{1, -1, 1}, {1, 3, 5}, 105] (* or *)

%t RecurrenceTable[{a[n] == a[n - 1] - a[n - 2] + a[n - 3], a[1] == 1, a[2] == 3, a[3] == 5}, a, {n, 105}]

%Y Inspired by the first difference of A108752.

%K nonn,easy

%O 1,2

%A _Robert G. Wilson v_, May 31 2017