A173635 Period 5 sequence: 1, 1, 4, 4, 2, ...
1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1, 1, 4, 4, 2, 1
Offset: 0
Examples
a(0) = 1 because (0^i) mod 10 = 0, i=1,2,...; a(2) = 4 since(2^1) mod 5 = 2, (2^2) mod 5 = 4, (2^3) mod 5 = 3, (2^4) mod 5 = 1, and (2^5) mod 5 = 2 again. So we have the sequence 2,4,3,1,... with period of length 4.
Links
- H. K. Funda, How to find out last digit
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,1).
Programs
-
Magma
&cat[ [1,1,4,4,2]: n in [0..23] ]; // Vincenzo Librandi, Jan 19 2018
-
Mathematica
Flatten[Table[{1, 1, 4, 4, 2}, {20}]] (* T. D. Noe, Nov 20 2012 *) CoefficientList[ Series[(-1 - x - 4x^2 - 4x^3 - 2x^4)/(x^5 -1), {x, 0, 104}], x] (* or *) LinearRecurrence[{0, 0, 0, 0, 1}, {1, 1, 4, 4, 2}, 105] (* Robert G. Wilson v, Jan 20 2018 *)
-
PARI
a(n) = [1, 1, 4, 4, 2][(n%5)+1] \\ Iain Fox, Jan 12 2018
-
PARI
a(n) = ((1 + floor((n%5)/2))^2) % 7 \\ Iain Fox, Jan 12 2018
-
PARI
first(n) = Vec((1 + x + 4*x^2 + 4*x^3 + 2*x^4)/(1 - x^5) + O(x^n)) \\ Iain Fox, Jan 12 2018
Formula
a(n) = (1 + floor((n mod 5)/2))^2 mod 7. - Victor Dumbrava, Jan 12 2018
G.f.: (1 + x + 4*x^2 + 4*x^3 + 2*x^4)/(1 - x^5). - Iain Fox, Jan 12 2018
Comments