A065881 Ultimate modulo 10: right-hand nonzero digit of n.
1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2, 3, 4, 5
Offset: 1
Examples
a(3)=3, a(23)=3, a(30)=3, a(12300)=3.
Links
Crossrefs
Programs
-
Mathematica
um10[n_]:=Module[{idns=Split[IntegerDigits[n]]},If[idns[[-1,1]] == 0, idns[[-2,1]], idns[[-1,1]]]]; Array[um10,110] (* Harvey P. Dale, Dec 26 2016 *)
-
PARI
a(n) = { n/10^valuation(n,10)%10 } \\ Harry J. Smith, Nov 03 2009
-
Python
def A065881(n): return int(str(n).rstrip('0')[-1]) # Chai Wah Wu, Dec 07 2023
Formula
If n mod 10 = 0 then a(n) = a(n/10), otherwise a(n) = n mod 10.