%I #67 Dec 14 2023 06:16:56
%S 1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,
%T 9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,1,7,9,3,
%U 1,7,9,3,1,7,9,3,1,7,9,3,1
%N Final digit of 7^n.
%C Period 4: repeat [1, 7, 9, 3]. - _Joerg Arndt_, Aug 12 2014
%H Derek Orr, <a href="/A001903/b001903.txt">Table of n, a(n) for n = 0..1000</a>
%H Edward Omey and Stefan Van Gulck, <a href="https://www.researchgate.net/publication/269418139_What_are_the_last_digits_of">What are the last digits of ...?</a>, International Journal of Mathematical Education in Science and Technology, (2015) 46:1, 147-155.
%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 a(n) = 7^n mod 10. - _Zerinvary Lajos_, Nov 03 2009
%F From _R. J. Mathar_, Apr 20 2010: (Start)
%F a(n) = a(n-1) - a(n-2) + a(n-3) for n > 2.
%F G.f.: ( 1+6*x+3*x^2 ) / ( (1-x)*(1+x^2) ). (End)
%F a(n) = 10 - a(n-2) for n > 1. - _Vincenzo Librandi_, Feb 08 2011
%F From _Bruno Berselli_, Feb 08 2011: (Start)
%F a(n) = 5 - (2-i)*(-i)^n - (2+i)*i^n, where i=sqrt(-1).
%F a(n) = A001148(A159966(n)). (End)
%F a(n) = A010879(A000420(n)). - _Michel Marcus_, Jul 06 2016
%F E.g.f.: 2*sin(x) - 4*cos(x) + 5*exp(x). - _Ilya Gutkovskiy_, Jul 06 2016
%p A001903:=n->7^n mod 10: seq(A001903(n), n=0..100); # _Wesley Ivan Hurt_, Aug 12 2014
%t Table[PowerMod[7, n, 10], {n, 0, 200}] (* _Vladimir Joseph Stephan Orlovsky_, Jun 10 2011 *)
%o (Sage) [power_mod(7,n,10)for n in range(0,81)] # _Zerinvary Lajos_, Nov 03 2009
%o (Magma)[7^n mod 10: n in [0..57]]; // _Vincenzo Librandi_, Feb 08 2011
%o (PARI) a(n)=lift(Mod(7,10)^n) \\ _Charles R Greathouse IV_, Dec 28 2012
%Y Cf. A000420, A001148, A010879, A131707, A159966.
%K nonn,easy
%O 0,2
%A _N. J. A. Sloane_