A215887 Written in decimal, n ends in a(n) consecutive nonzero digits.
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0
Offset: 0
Examples
Numbers which are multiples of 10 have no nonzero digit at their (right) end, thus a(10*k) = 0. If numbers are congruent to 1,...,9 mod 100, then they end in a nonzero digit, but do not have more than 1 concatenated nonzero digits at their right end: Thus, a(100k+m)=1 for 0 < m < 10. In the same way, a(k*10^(e+1)+m) = e if 10^e > m > 10^(e-1).
Links
- Antti Karttunen, Table of n, a(n) for n = 0..11111
Programs
-
Mathematica
Table[Which[Divisible[n,10],0,FreeQ[IntegerDigits[n],0], IntegerLength[ n], True, Position[ Reverse[ IntegerDigits[n]],0]-1],{n,0,110}] // Flatten (* Harvey P. Dale, Sep 05 2017 *) f[n_] := Block[{c = 0, m = n}, While[Mod[m, 10] > 0, m = Floor[m/10]; c++]; c]; Array[f, 105, 0] (* Robert G. Wilson v, Dec 07 2017 *)
-
PARI
a(n,b=10)= n=divrem(n,b); for(c=0,9e9, n[2] || return(c); n=divrem(n[1],b))
-
PARI
a(n)=my(k);while(n%10, n\=10; k++); k \\ Charles R Greathouse IV, Sep 26 2013
Extensions
More terms from Antti Karttunen, Dec 07 2017
Comments