= Base-p digit sum
{title2=$d_p(n)$}
For a <nonnegative integer> $n$ and <integer> base $p\geq2$, write its <base-p expansion> as
$$
n=\sum_{r\geq0}\alpha_rp^r,
\qquad 0\leq\alpha_r<p,
$$
The base-$p$ digit sum is $d_p(n)=\sum_r\alpha_r$, with $d_p(0)=0$. When $p$ is a <prime number>, the <Legendre formula> becomes
$$
v_p(n!)=\frac{n-d_p(n)}{p-1}.
$$
To see the connection, divide the <base-p expansion> by $p^j$ and discard the fractional part. Swapping the resulting finite sums and using a <finite geometric series> gives
$$
\sum_{j\geq1}\left\lfloor\frac n{p^j}\right\rfloor
=\sum_{r\geq1}\alpha_r\sum_{j=1}^r p^{r-j}
=\sum_{r\geq0}\alpha_r\frac{p^r-1}{p-1}
=\frac{n-d_p(n)}{p-1}.
$$
In particular, $50=1\cdot27+2\cdot9+1\cdot3+2=(1212)_3$, so $d_3(50)=6$ and $v_3(50!)=(50-6)/2=22$. The leading <numeral digit> contributes thirteen, the next contributes eight, the next one, and the units contribute zero. Thus the <base-p digit sum> compresses the same contribution ledger into information already present in <positional notation>.
Back to article page