A010879 Final digit of n.
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,0,1).
- Index entries for sequences related to final digits of numbers
Crossrefs
Programs
-
Haskell
a010879 = (`mod` 10) a010879_list = cycle [0..9] -- Reinhard Zumkeller, Mar 26 2012
-
Magma
[n mod(10): n in [0..90]]; // Vincenzo Librandi, Jun 17 2015
-
Maple
A010879 := proc(n) n mod 10 ; end proc: # R. J. Mathar, Jul 12 2013
-
Mathematica
Table[10*FractionalPart[n/10], {n, 1, 300}] (* Enrique Pérez Herrero, Jul 30 2009 *) LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 1},{0, 1, 2, 3, 4, 5, 6, 7, 8, 9},81] (* Ray Chandler, Aug 26 2015 *) PadRight[{},100,Range[0,9]] (* Harvey P. Dale, Oct 04 2021 *)
-
PARI
a(n)=n%10 \\ Charles R Greathouse IV, Jun 16 2011
-
Python
def a(n): return n % 10 # Martin Gergov, Oct 17 2022
-
Sage
[power_mod(n,5,10)for n in range(0, 81)] # Zerinvary Lajos, Nov 04 2009
Formula
a(n) = n mod 10.
Periodic with period 10.
From Hieronymus Fischer, May 31 and Jun 11 2007: (Start)
Complex representation: a(n) = 1/10*(1-r^n)*sum{1<=k<10, k*product{1<=m<10,m<>k, (1-r^(n-m))}} where r=exp(Pi/5*i) and i=sqrt(-1).
Trigonometric representation: a(n) = (256/5)^2*(sin(n*Pi/10))^2 * sum{1<=k<10, k*product{1<=m<10,m<>k, (sin((n-m)*Pi/10))^2}}.
G.f.: g(x) = (Sum_{k=1..9} k*x^k)/(1-x^10) = -x*(1 +2*x +3*x^2 +4*x^3 +5*x^4 +6*x^5 +7*x^6 +8*x^7 +9*x^8) / ( (x-1) *(1+x) *(x^4+x^3+x^2+x+1) *(x^4-x^3+x^2-x+1) ).
Also: g(x) = x*(9*x^10-10*x^9+1)/((1-x^10)*(1-x)^2).
a(n) = 10*{n/10}, where {x} means fractional part of x. - Enrique Pérez Herrero, Jul 30 2009
a(n) = n - 10*A059995(n). - Reinhard Zumkeller, Jul 26 2011
a(n) = n^k mod 10, for k > 0, where k mod 4 = 1. - Doug Bell, Jun 15 2015
Extensions
Formula section edited for better readability by Hieronymus Fischer, Jun 13 2012
Comments