login
Final digit of n.
162

%I #77 Oct 18 2022 03:33:39

%S 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,

%T 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,

%U 8,9,0,1,2,3,4,5,6,7,8,9,0

%N Final digit of n.

%C Also decimal expansion of 137174210/1111111111 = 0.1234567890123456789012345678901234... - _Jason Earls_, Mar 19 2001

%C In general the base k expansion of A062808(k)/A048861(k) (k>=2) will produce the numbers 0,1,2,...,k-1 repeated with period k, equivalent to the sequence n mod k. The k-digit number in base k 123...(k-1)0 (base k) expressed in decimal is A062808(k), whereas A048861(k) = k^k-1. In particular, A062808(10)/A048861(10)=1234567890/9999999999=137174210/1111111111.

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

%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).

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

%F a(n) = n mod 10.

%F Periodic with period 10.

%F From _Hieronymus Fischer_, May 31 and Jun 11 2007: (Start)

%F 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).

%F 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}}.

%F G.f.: g(x) = (sum{1<=k<10, 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) ).

%F Also: g(x) = x(9x^10-10x^9+1)/((1-x^10)(1-x)^2).

%F a(n) = n mod 2+2*(floor(n/2)mod 5) = A000035(n) + 2*A010874(A004526(n)).

%F Also: a(n) = n mod 5+5*(floor(n/5)mod 2) = A010874(n)+5*A000035(A002266(n)). (End)

%F a(n) = 10*{n/10}, where {x} means fractional part of x. - _Enrique Pérez Herrero_, Jul 30 2009

%F a(n) = n - 10*A059995(n). - _Reinhard Zumkeller_, Jul 26 2011

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

%p A010879 := proc(n)

%p n mod 10 ;

%p end proc: # _R. J. Mathar_, Jul 12 2013

%t Table[10*FractionalPart[n/10], {n, 1, 300}] (* _Enrique Pérez Herrero_, Jul 30 2009 *)

%t 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 *)

%t PadRight[{},100,Range[0,9]] (* _Harvey P. Dale_, Oct 04 2021 *)

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

%o (PARI) a(n)=n%10 \\ _Charles R Greathouse IV_, Jun 16 2011

%o (Haskell)

%o a010879 = (`mod` 10)

%o a010879_list = cycle [0..9] -- _Reinhard Zumkeller_, Mar 26 2012

%o (Magma) [n mod(10): n in [0..90]]; // _Vincenzo Librandi_, Jun 17 2015

%o (Python) def a(n): return n % 10 # _Martin Gergov_, Oct 17 2022

%Y Cf. A034948, A059988, A048861, A062808, A086457, A086458.

%Y Cf. A008959, A008960, A070514. - _Doug Bell_, Jun 15 2015

%Y Partial sums: A130488. Other related sequences A130481, A130482, A130483, A130484, A130485, A130486, A130487.

%K nonn,base,easy

%O 0,3

%A _N. J. A. Sloane_

%E Formula section edited for better readability by _Hieronymus Fischer_, Jun 13 2012