For a nonnegative integer and integer base , write its base-p expansion asThe base- digit sum is , with . When is a prime number, the Legendre formula becomesTo see the connection, divide the base-p expansion by and discard the fractional part. Swapping the resulting finite sums and using a finite geometric series givesIn particular, , so and . 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.
New to topics? Read the docs here!