A257164 Period 5 sequence: repeat [0, 2, 4, 1, 3].
0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 0, 2
Offset: 0
Examples
0 -> 2 -> 4 -> 1 -> 3 -> ..repeat
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,1).
Programs
-
Magma
[(2*n mod 5) : n in [0..100]];
-
Maple
A257164:=n->(2*n mod 5): seq(A257164(n), n=0..100);
-
Mathematica
Mod[2 Range[0, 100], 5] (* or *) CoefficientList[Series[x (2 + 4 x + x^2 + 3 x^3)/(1 - x^5), {x, 0, 100}], x] LinearRecurrence[{0, 0, 0, 0, 1}, {0, 2, 4, 1, 3}, 105] (* or *) NestList[# /. {0 -> 2, 1 -> 3, 2 -> 4, 3 -> 0, 4 -> 1} &, {0}, 104] // Flatten (* Robert G. Wilson v, Apr 30 2015 *)
-
PARI
a(n)=2*n%5 \\ Charles R Greathouse IV, Apr 21 2015
Formula
G.f.: x*(2+4*x+x^2+3*x^3)/(1-x^5).
Recurrence: a(n) = a(n-5).
a(n) = a(a(a(a(a(n))))).
a(-n) = A010874(3n) = a(a(a(n))).
Comments