A000689 Final decimal digit of 2^n.
1, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6, 2, 4, 8, 6
Offset: 0
Examples
G.f. = 1 + 2*x + 4*x^2 + 8*x^3 + 6*x^4 + 2*x^5 + 4*x^6 + 8*x^7 + 6*x^8 + ...
Links
- David Applegate, Marc LeBrun and N. J. A. Sloane, Carryless Arithmetic (I): The Mod 10 Version
- Index entries for sequences related to carryless arithmetic
- Index entries for sequences related to final digits of numbers
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1).
Programs
-
Haskell
a000689 n = a000689_list !! n a000689_list = 1 : cycle [2,4,8,6] -- Reinhard Zumkeller, Sep 15 2011
-
Magma
[2^n mod 10: n in [0..150]]; // Vincenzo Librandi, Apr 12 2011
-
Mathematica
Table[PowerMod[2, n, 10], {n, 0, 200}] (* Vladimir Joseph Stephan Orlovsky, Jun 10 2011 *)
-
PARI
for(n=0,80, if(n,{x=(n+3)%4+1; print1(10-(4*x^3+47*x-27*x^2)/3,", ")},{print1("1, ")}))
-
SageMath
[power_mod(2,n,10)for n in range(0, 81)] # Zerinvary Lajos, Nov 03 2009
Formula
Periodic with period 4.
a(n) = 2^n mod 10.
From R. J. Mathar, Apr 13 2010: (Start)
a(n) = a(n-1) - a(n-2) + a(n-3), n > 3.
G.f.: (x+3*x^2+5*x^3+1)/((1-x) * (1+x^2)). (End)
For n >= 1, a(n) = 10 - (4x^3 + 47x - 27x^2)/3, where x = (n+3) mod 4 + 1.
For n >= 1, a(n) = A070402(n) + 5*floor( ((n-1) mod 4)/2 ).
G.f.: 1 / (1 - 2*x / (1 + 5*x^3 / (1 + x / (1 - 3*x / (1 + 3*x))))). - Michael Somos, May 12 2012
a(n) = 5 + cos((n*Pi)/2) - 3*sin((n*Pi)/2) for n >= 1. - Kritsada Moomuang, Dec 21 2021
Comments