login
A215887
Written in decimal, n ends in a(n) consecutive nonzero digits.
6
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,12
COMMENTS
Sequences A215879, A215883 and A215884 are the base 3, 4 and 5 analogs, while the base 2 analog of this sequence coincides (up to a shift in the index) with the 2-adic valuation A007814, see comments there.
Starting indexing with k=0 for the rightmost digit, a(n) gives the index of the least significant zero in the decimal representation of n. This may also be the index of the leading zero if there are no zeros in the number itself (A052382). - Antti Karttunen, Dec 07 2017
First occurrence of k is A002275(k). - Robert G. Wilson v, Dec 07 2017
LINKS
EXAMPLE
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).
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 *)
PROG
(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
CROSSREFS
Cf. A002275, A052382, A339012 (factorial base).
Sequence in context: A297035 A055178 A174847 * A159451 A336682 A103159
KEYWORD
nonn,base,easy
AUTHOR
M. F. Hasler, Aug 25 2012
EXTENSIONS
More terms from Antti Karttunen, Dec 07 2017
STATUS
approved