OFFSET
0,7
COMMENTS
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
EXAMPLE
The numbers 24,...,31 are written in base 5 as 44,100,101,102,103,104,110,111 and thus end in a string of a(24..31)=2,0,1,1,1,1,0,3 nonzero digits.
MATHEMATICA
cnzd[n_]:=Module[{c=Split[If[#>0, 1, 0]&/@IntegerDigits[n, 5]]}, If[FreeQ[ c[[-1]], 0], Total[c[[-1]]], 0]]; Array[cnzd, 120, 0] (* Harvey P. Dale, Jan 03 2023 *)
PROG
(PARI) a(n, b=5)=n=divrem(n, b); for(c=0, 9e9, n[2]||return(c); n=divrem(n[1], b))
(PARI) a(n)=my(k); while(n%5, n\=5; k++); k \\ Charles R Greathouse IV, Sep 26 2013
CROSSREFS
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Aug 25 2012
STATUS
approved