%I #81 Dec 18 2023 09:37:44
%S 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,
%T 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,
%U 6,2,4,8,6,2,4,8,6,2,4,8,6
%N Final decimal digit of 2^n.
%C These are the analogs of the powers of 2 in carryless arithmetic mod 10.
%C Let G = {2,4,8,6}. Let o be defined as XoY = least significant digit in XY. Then (G,o) is an Abelian group wherein 2 is a generator (also see the first comment under A001148). - _K.V.Iyer_, Mar 12 2010
%C This is also the decimal expansion of 227/1818. - _Kritsada Moomuang_, Dec 21 2021
%H David Applegate, Marc LeBrun and N. J. A. Sloane, <a href="http://neilsloane.com/doc/carry1.pdf">Carryless Arithmetic (I): The Mod 10 Version</a>
%H <a href="/index/Ca#CARRYLESS">Index entries for sequences related to carryless arithmetic</a>
%H <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-1,1).
%F Periodic with period 4.
%F a(n) = 2^n mod 10.
%F a(n) = A002081(n) - A002081(n-1), for n > 0.
%F From _R. J. Mathar_, Apr 13 2010: (start)
%F a(n) = a(n-1) - a(n-2) + a(n-3), n > 3.
%F G.f.: (x+3*x^2+5*x^3+1)/((1-x) * (1+x^2)). (End)
%F For n >= 1, a(n) = 10 - (4x^3 + 47x - 27x^2)/3, where x = (n+3) mod 4 + 1.
%F For n >= 1, a(n) = A070402(n) + 5*floor( ((n-1) mod 4)/2 ).
%F G.f.: 1 / (1 - 2*x / (1 + 5*x^3 / (1 + x / (1 - 3*x / (1 + 3*x))))). - _Michael Somos_, May 12 2012
%F a(n) = 5 + cos((n*Pi)/2) - 3*sin((n*Pi)/2) for n >= 1. - _Kritsada Moomuang_, Dec 21 2021
%e 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 + ...
%t Table[PowerMod[2, n, 10], {n, 0, 200}] (* _Vladimir Joseph Stephan Orlovsky_, Jun 10 2011 *)
%o (Sage) [power_mod(2,n,10)for n in range(0, 81)] # _Zerinvary Lajos_, Nov 03 2009
%o (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, ")}))
%o (Magma) [2^n mod 10: n in [0..150]]; // _Vincenzo Librandi_, Apr 12 2011
%o (Haskell)
%o a000689 n = a000689_list !! n
%o a000689_list = 1 : cycle [2,4,8,6] -- _Reinhard Zumkeller_, Sep 15 2011
%Y Cf. A000079, A00855, A008952, A034887, A173635.
%K nonn,base,easy
%O 0,2
%A _N. J. A. Sloane_
|