login
Written in decimal, n ends in a(n) consecutive nonzero digits.
6

%I #33 Nov 25 2020 21:29:48

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

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

%U 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

%N Written in decimal, n ends in a(n) consecutive nonzero digits.

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

%C 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

%C First occurrence of k is A002275(k). - _Robert G. Wilson v_, Dec 07 2017

%H Antti Karttunen, <a href="/A215887/b215887.txt">Table of n, a(n) for n = 0..11111</a>

%e Numbers which are multiples of 10 have no nonzero digit at their (right) end, thus a(10*k) = 0.

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

%e In the same way, a(k*10^(e+1)+m) = e if 10^e > m > 10^(e-1).

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

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

%o (PARI) a(n,b=10)= n=divrem(n,b); for(c=0,9e9, n[2] || return(c); n=divrem(n[1],b))

%o (PARI) a(n)=my(k);while(n%10, n\=10; k++); k \\ _Charles R Greathouse IV_, Sep 26 2013

%Y Cf. A002275, A052382, A339012 (factorial base).

%K nonn,base,easy

%O 0,12

%A _M. F. Hasler_, Aug 25 2012

%E More terms from _Antti Karttunen_, Dec 07 2017