A014391 Final digit of 8^n.
1, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6, 8, 4, 2, 6
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- Index entries for sequences related to final digits of numbers
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1).
Programs
-
Magma
[Modexp(8, n, 10): n in [0..100]]; // Vincenzo Librandi, Jun 30 2016
-
Mathematica
Table[PowerMod[8, n, 10], {n, 0, 200}] (* Vladimir Joseph Stephan Orlovsky, Jun 10 2011 *) LinearRecurrence[{1,-1,1},{1,8,4,2},100] (* Harvey P. Dale, Jul 01 2019 *)
-
PARI
a(n)=lift(Mod(8,10)^n) \\ Charles R Greathouse IV, Dec 29 2012
-
Sage
[power_mod(8,n,10)for n in range(0,105)] # Zerinvary Lajos, Nov 27 2009
Formula
a(n) = 8^n mod 10. [Zerinvary Lajos, Nov 27 2009]
G.f.: -(7*x - 3*x^2 + 5*x^3 + 1)/ ((x - 1)*(1 + x^2)). [R. J. Mathar, Apr 20 2010]
a(n) = +a(n-1) -a(n-2) +a(n-3). [R. J. Mathar, Apr 20 2010]