%I #51 Dec 14 2023 06:16:44
%S 1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,
%T 9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,1,3,9,7,
%U 1,3,9,7,1,3,9,7,1,3,9,7,1
%N Final digit of 3^n.
%C Let G = {1,3,7,9}, and let the binary operator o be defined as: X o Y = least significant digit of the product XY, where X,Y belong to G. Then (G,o) is an Abelian group and 3 is a generator of this group. - _K.V.Iyer_, Apr 19 2009
%C 3^n mod 10 and 3^n mod 20. - _Zerinvary Lajos_, Nov 25 2009
%C Continued fraction expansion of (243+17*sqrt(285))/4020 = 0.13183906... (see A178148). - _Klaus Brockhaus_, Apr 17 2011
%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 From _R. J. Mathar_, Apr 13 2010: (Start)
%F a(n) = a(n-1) - a(n-2) + a(n-3).
%F G.f.: (1+2*x+7*x^2)/ ((1-x) * (1+x^2)). (End)
%F a(n) = 5 - (2+i)*(-i)^n - (2-i)*i^n, where i is the imaginary unit. Also a(n) = A001903(A159966(n)). - _Bruno Berselli_, Feb 08 2011
%F a(0)=1, a(1)=3, a(n) = 10 - a(n-2). - _Vincenzo Librandi_, Feb 08 2011
%t Table[PowerMod[3, n, 10], {n, 0, 200}] (* _Vladimir Joseph Stephan Orlovsky_, Jun 10 2011 *)
%o (Sage) [power_mod(3, n, 10) for n in range(0, 81)] # _Zerinvary Lajos_, Nov 24 2009
%o (Magma) [3^n mod 10: n in [0..150]]; // _Vincenzo Librandi_, Apr 12 2011
%o (PARI) a(n)=[1, 3, 9, 7][n%4+1] \\ _Charles R Greathouse IV_, Dec 27 2012
%K nonn,cofr,easy
%O 0,2
%A _N. J. A. Sloane_
|