I choose some positive integer b and write down all nonnegative integers (so 0 is included) less than b 3 in one list, but I write them in base b , and then all nonnegative integers less than b 7 in another list, also written in base b . Then I compute the average digit sum of all numbers in the first list and the average digit sum of all numbers in the second list. These two averages have a difference of 2018 (in base 10).
Which integer b did I choose?
Other parts
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.
how did you compute the toal number of digits at the begining of the problem
Log in to reply
There would be b n numbers at n digits each. For example, for the number of digits less than 1 0 2 in base 1 0 (i.e. the numbers 00-99) there are 1 0 0 numbers at 2 digits each, for a total of 2 0 0 digits.
Log in to reply
how can we say that, all the digits will appear equally?
Log in to reply
@Venkatesh A – All numbers up to b n include every variation of the digits 0 to b , so every digit will appear equally.
This is brilliant.
The main idea, that I also used for the harder version, is as bellow. I think, with the hard one, if you take my approach, you eventually need to make some approximation and reaching the actual solution is rather difficult (I am prone to make mistakes though).
In any base b , there are b symbols { 0 , 1 , … , ( b − 1 ) } . The number of times a symbol k is used, in numbers from 0 to p t , is denoted by n k ( t ) . It can be shown that n k ( t ) ∀ k = 1 , … , ( b − 1 ) is the same, when t is fixed, except for n 0 ( t ) = 2 n k ( t ) k = 1 , … , p − 1 . So, if we know how many digits have been used in numbers from 0 to p t (denoted by N ( t ) ), then we would know n k ( t ) ∀ k .
N ( t ) = b + ∑ 2 t j ( b j − b j − 1 ) = t . b t − b − 1 b t − b
which should be equal to
∑ j = 0 b − 1 n j ( t ) = 2 4 5 n 1 ( t )
So, we have a relation between n i ( t ) ∀ i and b .
finally, we need to calculate
p t ∑ j = 0 b − 1 n j ( t ) . j = p t ∑ j = 1 b − 1 n j ( t ) . j = 2 b t ( b − 1 ) b n 1 ( t )
relation between n i ( t ) ∀ i and b come useful now. We substitute n 1 ( t ) to have a fraction that depends only on b . Then, t is taken to be 3 and 7 , because of b 3 , b 7 , and the difference of their results is supposed to be equal to 2018. The rest was done numerically (the finale equation can be rewritten as a polynomial of order 7). There would be only one solution that can be the final answer and that would be 1 0 0 9 . 5 and I tried both 1 0 0 9 and 1 0 1 0 .
I got the formula
∅ b ( t ) = 2 b − 1 t
Where ∅ b ( t ) denotes the average digit sum of all integers less than b t in base b .
With this formula, it's easy to write an equation for the average up to b 3 and b 7 respectively and then set their difference equal to 2018
2 b − 1 ⋅ 7 − 2 b − 1 ⋅ 3 ⇔ 2 ( b − 1 ) ⇔ b = 2 0 1 8 = 2 0 1 8 = 1 0 1 0
So, I'm wondering how you used a method that didn't give exactly 1010.
Log in to reply
why don't you post your solution? it seems you keep the community interested in working on the question by not posting a solution. Where do you find these problems anyways?
Log in to reply
I watched a video by blackpenredpen on Youtube that is about binary numbers, and then I asked myself about the average number of powers of 2 needed to express some integer as their sum. This is the same question as the average digit sum. Then, I generalized this to any base.
Log in to reply
@Henry U – you are awesome man
Log in to reply
@A Former Brilliant Member – You too! You're number theory questions are really interesting and just the right difficulty for me.
I will post my solution, but it takes a lot of writing and I haven't had the time so far.
I have posted my solution now.
David Vreken just posted a solution on the other problem where he also comes to this formula with a different approach than yours and mine.
Log in to reply
David is a proper nerd. I am just a homeless drunk person :)
Here let's take the Average digit sum of all the numbers from 0 to b n be A ( n ) Therefore, we must find A ( n ) + 1 . The average of first b n integers is A ( n ) . The average of the next b n integers is A ( n ) + 1 as b ( n + 1 ) place is 1. Similarly, next average is A(n)+2\ ) and so on until \(b^(n+1) place is b − 1 . Hence, A ( n + 1 ) = b ∑ i = 0 ( b − 1 ) A ( n ) + i = b A ( n ) ∗ b + 2 b ( b − 1 ) ) = A ( n ) + 2 b ( b − 1 )
A(0)=0.
Let's try to find a pattern by first considering numbers in base 2:
decimal | 0 1 0 | 1 1 0 | 2 1 0 | 3 1 0 | 4 1 0 | 5 1 0 | 6 1 0 | 7 1 0 | 8 1 0 | 9 1 0 | 1 0 1 0 | 1 1 1 0 | 1 2 1 0 | 1 3 1 0 | 1 4 1 0 | 1 5 1 0 | … |
binary | 0 2 | 1 2 | 1 0 2 | 1 1 2 | 1 0 0 2 | 1 0 1 2 | 1 1 0 2 | 1 1 1 2 | 1 0 0 0 2 | 1 0 0 1 2 | 1 0 1 0 2 | 1 0 1 1 2 | 1 1 0 0 2 | 1 1 0 1 2 | 1 1 1 0 2 | 1 1 1 1 2 | … |
digit sum | 0 | 1 | 1 | 2 | 1 | 2 | 2 | 3 | 1 | 2 | 2 | 3 | 2 | 3 | 3 | 4 | … |
The average digit sums of all integers less than 2 n , denoted by ∅ 2 ( n ) can now be calculated:
n | 0 | 1 | 2 | 3 | 4 | 5 | … |
∅ 2 ( n ) | 0 | 2 1 | 1 | 2 3 | 2 | 2 5 | … |
It looks like, ∅ 2 ( n ) = 2 1 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 and 4 = 2 2 respectively.
decimal | 0 1 0 | 1 1 0 | 2 1 0 | 3 1 0 | 4 1 0 | 5 1 0 | 6 1 0 | 7 1 0 | 8 1 0 | 9 1 0 | 1 0 1 0 | 1 1 1 0 | 1 2 1 0 | 1 3 1 0 | 1 4 1 0 | 1 5 1 0 | … |
binary | 0 2 | 1 2 | 1 0 2 | 1 1 2 | 1 0 0 2 | 1 0 1 2 | 1 1 0 2 | 1 1 1 2 | 1 0 0 0 2 | 1 0 0 1 2 | 1 0 1 0 2 | 1 0 1 1 2 | 1 1 0 0 2 | 1 1 0 1 2 | 1 1 1 0 2 | 1 1 1 1 2 | … |
digit sum | 0 | 1 | 1 | 2 | 1 | 2 | 2 | 3 | 1 | 2 | 2 | 3 | 2 | 3 | 3 | 4 | … |
group average | 2 1 | 2 2 | 2 3 | 2 4 | 2 5 | 2 6 | 2 7 | 2 9 | … | ||||||||
group average | 1 | 2 | 2 | 3 | … |
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 to 2 n + 1 − 1 are written almost like the numbers from 0 to 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 numbers ), so 2 1 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 ) = 2 1 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 1 0 | 1 1 0 | 2 1 0 | 3 1 0 | 4 1 0 | 5 1 0 | 6 1 0 | 7 1 0 | 8 1 0 | 9 1 0 | 1 0 1 0 | 1 1 1 0 | 1 2 1 0 | 1 3 1 0 | 1 4 1 0 | 1 5 1 0 | 1 6 1 0 | 1 7 1 0 | … |
binary | 0 2 | 1 2 | 2 3 | 1 0 3 | 1 1 3 | 1 2 3 | 2 0 3 | 2 1 3 | 2 2 3 | 1 0 0 3 | 1 0 1 3 | 1 0 2 3 | 1 1 0 3 | 1 1 1 3 | 1 1 2 3 | 1 2 0 3 | 1 2 1 3 | 1 2 2 3 | … |
digit sum | 0 | 1 | 2 | 1 | 2 | 3 | 2 | 3 | 4 | 1 | 2 | 3 | 2 | 3 | 4 | 3 | 4 | 5 | … |
group average | 1 | 2 | 3 | 2 | 3 | 4 | … |
Again, the pattern repeats self-similarly, and we can write the formula
∅ 3 ( n ) = n
Now, it's time to generalize. What we've got so far is
∅ 2 ( n ) = 2 1 n
∅ 3 ( n ) = n = 2 2 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 ) is
∅ b ( n ) = 2 b − 1 n .
After all this, we can plug in n = 3 and n = 7 .
∅ b ( 3 ) = 2 b − 1 ⋅ 3
∅ b ( 7 ) = 2 b − 1 ⋅ 7
We are given that their difference is 2018, so we can set up the equation
2 b − 1 ⋅ 7 − 2 b − 1 ⋅ 3 4 ( 2 b − 1 ) 2 ( b − 1 ) b = 2 0 1 8 = 2 0 1 8 = 2 0 1 8 = 1 0 1 0
The average for a given power p is 2 p ( b − 1 ) . This is derived as the lower limit of a digit range is 0 and the upper limit is b − 1 and you need the average of those limits as the digits add pairwise from each end of the range. The sum for multiple digit base- b is the power times the single digit average. Solve 2 7 ( b − 1 ) − 2 3 ( b − 1 ) = 2 0 1 8 for b . b is 1 0 1 0 .
Problem Loading...
Note Loading...
Set Loading...
Let us first find a general equation for the average of all the digit sums of all nonnegative integers less than b n written down in base b .
Including zeroes as leading digits, there are n b n total digits. Since they all appear equally, each digit from 0 to b appears b n b n times, which makes the sum of all the digits b n b n ( 0 + 1 + 2 + . . . + ( b − 1 ) ) and the average of all the digit sums b ⋅ b n n b n ( 0 + 1 + 2 + . . . + ( b − 1 ) ) or b n ( 0 + 1 + 2 + . . . + ( b − 1 ) ) .
The sum 0 + 1 + 2 + . . . + ( b − 1 ) can be expressed as 2 b ( b − 1 ) . Substituting this in, the average of all the digit sums is now b n ( 2 b ( b − 1 ) ) or 2 n ( b − 1 ) .
This means that the average of all the digit sums of all the nonnegative integers less than b 7 is 2 7 ( b − 1 ) , and the average of all the digit sums of all the nonnegative integers less than b 3 is 2 3 ( b − 1 ) , for a difference of 2 7 ( b − 1 ) − 2 3 ( b − 1 ) = 2 b − 2 . Equating this to 2 0 1 8 , 2 b − 2 = 2 0 1 8 , which solves to b = 1 0 1 0 .