Average digit sum

When all nonnegative integers (so 0 is included) less than 2 5 2018 25^{2018} are written down in base 25 25 , what will be the average of all their digit sums?

Other parts

Note:

The digit sum of a number is the sum of all its digits. For example, the digit sum of 2018 is 2 + 0 + 1 + 8 = 11 2+0+1+8=11 .


The answer is 24216.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

David Vreken
Dec 13, 2018

Let us first find a general equation for the average of all the digit sums of all nonnegative integers less than b n b^n written down in base b b .

Including zeroes as leading digits, there are n b n nb^n total digits. Since they all appear equally, each digit from 0 0 to b b appears n b n b \frac{nb^n}{b} times, which makes the sum of all the digits n b n ( 0 + 1 + 2 + . . . + ( b 1 ) ) b \frac{nb^n(0 + 1 + 2 + ... + (b - 1))}{b} and the average of all the digit sums n b n ( 0 + 1 + 2 + . . . + ( b 1 ) ) b b n \frac{nb^n(0 + 1 + 2 + ... + (b - 1))}{b \cdot b^n} or n ( 0 + 1 + 2 + . . . + ( b 1 ) ) b \frac{n(0 + 1 + 2 + ... + (b - 1))}{b} .

The sum 0 + 1 + 2 + . . . + ( b 1 ) 0 + 1 + 2 + ... + (b - 1) can be expressed as b ( b 1 ) 2 \frac{b(b - 1)}{2} . Substituting this in, the average of all the digit sums is now n ( b ( b 1 ) 2 ) b \frac{n(\frac{b(b - 1)}{2})}{b} or n ( b 1 ) 2 \frac{n(b - 1)}{2} .

In this problem, b = 25 b = 25 and n = 2018 n = 2018 , so the average of all the digit sums is 2018 ( 25 1 ) 2 = 24216 \frac{2018(25 - 1)}{2} = \boxed{24216} .

Arthur Wu
Jan 2, 2019

let's make all numbers less than 2 5 2018 25^{2018} 2018 (base-25) digits long (which does not affect the digit sum). Then we see that on each digit position 0~24 appear exactly the same number of times. The average of 0~24 is 12, so the average digit sum is 2018 × 12 = 24216 2018 \times 12 = 24216 .

Dong kwan Yoo
Dec 13, 2018

From 00... 0 ( 25 ) 00...0 _{(25)} to ( 24 ) ( 24 ) . . . ( 24 ) ( 25 ) (24)(24)...(24) _{(25)} ,

We can make 2 5 2018 1 2 \frac{ 25^{2018} -1} {2} pairs :
( ( a 1 ) ( a 2 ) . . . ( a 2018 ) , ( 24 a 1 ) ( 24 a 2 ) . . . ( 24 a 2018 ) ( (a_{1} ) (a_{2} )... (a_{2018} ) , ( 24 - a_{1} ) ( 24 - a_{2} ) ...(24 - a_{2018} ) )

and the averages of this pair are same ( = 24 2018 2 = \frac{ 24 * 2018 }{ 2} )

And then, only one number( = (12)(12)...(12) ) is center of them, and the sum of this digit is 24 2018 2 \frac{ 24 * 2018 }{ 2} , so this doesn't affect average .

So we can know the (Ans) is 24 2018 2 \frac{ 24 * 2018 }{ 2}

Henry U
Dec 15, 2018

Let's try to find a pattern by first considering numbers in base 2:

decimal 0 10 0_{10} 1 10 1_{10} 2 10 2_{10} 3 10 3_{10} 4 10 4_{10} 5 10 5_{10} 6 10 6_{10} 7 10 7_{10} 8 10 8_{10} 9 10 9_{10} 1 0 10 10_{10} 1 1 10 11_{10} 1 2 10 12_{10} 1 3 10 13_{10} 1 4 10 14_{10} 1 5 10 15_{10} \ldots
binary 0 2 0_2 1 2 1_2 1 0 2 10_2 1 1 2 11_2 10 0 2 100_2 10 1 2 101_2 11 0 2 110_2 11 1 2 111_2 100 0 2 1000_2 100 1 2 1001_2 101 0 2 1010_2 101 1 2 1011_2 110 0 2 1100_2 110 1 2 1101_2 111 0 2 1110_2 111 1 2 1111_2 \ldots
digit sum 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 \ldots

The average digit sums of all integers less than 2 n 2^n , denoted by 2 ( n ) \varnothing_2(n) can now be calculated:

n n 0 1 2 3 4 5 \ldots
2 ( n ) \varnothing_2(n) 0 1 2 \frac 12 1 1 3 2 \frac 32 2 2 5 2 \frac 52 \ldots

It looks like, 2 ( n ) = 1 2 n \varnothing_2(n) = \frac 12 n . But why exactly is that?

Let's try to average the digit sums in a clever way by grouping them in groups of 2 = 2 1 2 = 2^1 and 4 = 2 2 4 = 2^2 respectively.

decimal 0 10 0_{10} 1 10 1_{10} 2 10 2_{10} 3 10 3_{10} 4 10 4_{10} 5 10 5_{10} 6 10 6_{10} 7 10 7_{10} 8 10 8_{10} 9 10 9_{10} 1 0 10 10_{10} 1 1 10 11_{10} 1 2 10 12_{10} 1 3 10 13_{10} 1 4 10 14_{10} 1 5 10 15_{10} \ldots
binary 0 2 0_2 1 2 1_2 1 0 2 10_2 1 1 2 11_2 10 0 2 100_2 10 1 2 101_2 11 0 2 110_2 11 1 2 111_2 100 0 2 1000_2 100 1 2 1001_2 101 0 2 1010_2 101 1 2 1011_2 110 0 2 1100_2 110 1 2 1101_2 111 0 2 1110_2 111 1 2 1111_2 \ldots
digit sum 0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4 \ldots
group average 1 2 \frac 12 2 2 \frac 22 3 2 \frac 32 4 2 \frac 42 5 2 \frac 52 6 2 \frac 62 7 2 \frac 72 9 2 \frac 92 \ldots
group average 1 2 2 3 \ldots

It looks like the average in every group just follows the same pattern as the digit sums. And this pattern will indeed continue. This is because the binary numbers from 2 n 2^n to 2 n + 1 1 2^{n+1}-1 are written almost like the numbers from 0 0 to 2 n 2^n , except for another digit 1 in the front, so their digit sum is just one more. Therefore, their average is 1 more than the average of the first half. The average of all numbers is the average of these two (since they both contain 2 n 2^n numbers ), so 1 2 \frac 12 more than the previous term. We can group the terms again and again until we get to a single number that is the average of all digit sums.

The formula for the average digit sum is indeed

2 ( n ) = 1 2 n \varnothing_2(n) = \frac 12 n


Let's try to do the same trick for base 3. This time, we can't group 4 numbers, but rather 3.

decimal 0 10 0_{10} 1 10 1_{10} 2 10 2_{10} 3 10 3_{10} 4 10 4_{10} 5 10 5_{10} 6 10 6_{10} 7 10 7_{10} 8 10 8_{10} 9 10 9_{10} 1 0 10 10_{10} 1 1 10 11_{10} 1 2 10 12_{10} 1 3 10 13_{10} 1 4 10 14_{10} 1 5 10 15_{10} 1 6 10 16_{10} 1 7 10 17_{10} \ldots
binary 0 2 0_2 1 2 1_2 2 3 2_3 1 0 3 10_3 1 1 3 11_3 1 2 3 12_3 2 0 3 20_3 2 1 3 21_3 2 2 3 22_3 10 0 3 100_3 10 1 3 101_3 10 2 3 102_3 11 0 3 110_3 11 1 3 111_3 11 2 3 112_3 12 0 3 120_3 12 1 3 121_3 12 2 3 122_3 \ldots
digit sum 0 1 2 1 2 3 2 3 4 1 2 3 2 3 4 3 4 5 \ldots
group average 1 2 3 2 3 4 \ldots

Again, the pattern repeats self-similarly, and we can write the formula

3 ( n ) = n \varnothing_3(n) = n


Now, it's time to generalize. What we've got so far is

2 ( n ) = 1 2 n \varnothing_2(n) = \frac 12 n

3 ( n ) = n = 2 2 n \varnothing_3(n) = n = \frac 22 n

The self-similar pattern will continue in all bases and the argument as explained for base 2 will also always work, so the general expreasion for b ( n ) \varnothing_b(n) is

b ( n ) = b 1 2 n \boxed{\varnothing_b(n) = \frac {b-1}2 n} .


After all this, we can simply plug in b = 25 , n = 2018 b=25, n=2018

25 ( 2018 ) = 25 1 2 2018 = 12 2018 = 24216 \varnothing_{25}(2018) = \frac {25-1}2 \cdot 2018 = 12 \cdot 2018 = \boxed{24216}

1 pending report

Vote up reports you agree with

×

Problem Loading...

Note Loading...

Set Loading...