Generalization of number of zeros listed from $1$ to a number

27 Views Asked by At

When listing the integers from $1$ to a number $x \in \mathbb{N},$ the number of times a zero is written is $$\sum^{\lfloor\log_{10}x\rfloor}_{k = 1} \left \lfloor{\frac{x}{10^k}}\right \rfloor.$$ Extending this to $x$ in other bases, it follows that the above statement can be generalized to any $x$ in a base $b$: $$\sum^{\lfloor\log_{b}x\rfloor}_{k = 1} \left \lfloor{\frac{x}{b^k}}\right \rfloor.$$ However, this does not seem to be an accurate statement. Could someone tell me where I went wrong with this?

1

There are 1 best solutions below

0
On BEST ANSWER

Fix a base $b \ge 2$, and let $x=b^2+1$.

For $1 \le n \le x$, we get

  • One zero if $n < b^2$ and $n$ a multiple of $b$, so these numbers contribute $b-1$ zeros to the count.$\\[4pt]$
  • Two zeros if $n=b^2$.$\\[4pt]$
  • One zero if $n=b^2+1$.

Thus, for $x=b^2+1$, the number of zeros is$\\[10pt]$ $$(b-1) + 2 + 1 = b+2$$ but $$ \sum^{\lfloor\log_{b}x\rfloor}_{k = 1} \left \lfloor{\frac{x}{b^k}}\right \rfloor = \left\lfloor{\frac{b^2+1}{b}}\right\rfloor+\left\lfloor{\frac{b^2+1}{b^2}}\right\rfloor=b+1$$