login
Final digit of squares: a(n) = n^2 mod 10.
20

%I #86 Dec 14 2023 06:03:17

%S 0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,

%T 6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,

%U 4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0,1,4,9,6,5,6,9,4,1,0

%N Final digit of squares: a(n) = n^2 mod 10.

%C a(m*n) = a(m)*a(n) mod 10; a(5*n+k) = a(5*n-k) for k <= 5*n. - _Reinhard Zumkeller_, Apr 24 2009

%C a(n) = n^6 mod 10. - _Zerinvary Lajos_, Nov 06 2009

%C a(n) = A002015(n) mod 10 = A174452(n) mod 10. - _Reinhard Zumkeller_, Mar 21 2010

%C Decimal expansion of 166285490/1111111111. - _Alexander R. Povolotsky_, Mar 09 2013

%H Harvey P. Dale, <a href="/A008959/b008959.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Fi#final">Index entries for sequences related to final digits of numbers</a>

%H <a href="/index/Rec#order_10">Index entries for linear recurrences with constant coefficients</a>, signature (0, 0, 0, 0, 0, 0, 0, 0, 0, 1).

%F Periodic with period 10. - _Franklin T. Adams-Watters_, Mar 13 2006

%F a(n) = 4.5 - (1 + 5^(1/2))*cos(Pi*n/5) + (-1 - 3/5*5^(1/2))*cos(2*Pi*n/5) + (5^(1/2) - 1)*cos(3*Pi*n/5) + (-1 + 3/5*5^(1/2))*cos(4*Pi*n/5) - 0.5*(-1)^n. - _Richard Choulet_, Dec 12 2008

%F a(n) = A010879(A000290(n)). - _Reinhard Zumkeller_, Jan 04 2009

%F G.f.: (x^9+4*x^8+9*x^7+6*x^6+5*x^5+6*x^4+9*x^3+4*x^2+x)/(-x^10+1). - _Colin Barker_, Aug 14 2012

%F a(n) = n^2 - 10*floor(n^2/10). - _Wesley Ivan Hurt_, Jun 12 2013

%F a(n) = (n - 5*A002266(n + 2))^2 + 5*(5*A002266(n + 2) mod 2). - _Wesley Ivan Hurt_, Jun 06 2014

%F a(n) = A033569(n+3) mod 10. - _Wesley Ivan Hurt_, Dec 06 2014

%F a(n) = n^k mod 10; for k > 0 where k mod 4 = 2. - _Doug Bell_, Jun 15 2015

%p A008959:=n->(n^2 mod 10); seq(A008959(n), n=0..50); # _Wesley Ivan Hurt_, Jun 06 2014

%t Table[Mod[n^2,10],{n,0,200}] (* _Vladimir Joseph Stephan Orlovsky_, Apr 21 2011 *)

%t PowerMod[Range[0,80],2,10] (* or *) LinearRecurrence[{0,0,0,0,0,0,0,0,0,1},{0,1,4,9,6,5,6,9,4,1},120] (* _Harvey P. Dale_, Oct 16 2012 *)

%o (Sage) [power_mod(n,2,10) for n in range(0, 81)] # _Zerinvary Lajos_, Nov 06 2009

%o (Magma) [0] cat [Intseq(n^2)[1]: n in [1..80]]; // _Bruno Berselli_, Feb 14 2013

%o (Magma) [n^2 - 10*Floor(n^2/10): n in [0..80]]; // _Vincenzo Librandi_, Jun 16 2015

%o (PARI) a(n)=n^2%10 \\ _Charles R Greathouse IV_, Sep 24 2015

%Y Cf. A000290, A070431, A070435, A070438, A070442, A070452, A159852, A010879, A008960, A070514.

%K nonn,easy,base

%O 0,3

%A _N. J. A. Sloane_, Mar 15 1996