Alan and Bob are playing with numbers. Starting with the number they take turns performing arithmetic manipulations with . Alan goes first and always multiplies the current number by . Bob adds or to the current number, depending on a coin toss. A number is called reachable, if it can possibly appear in this game. How many reachable numbers are there between and (inclusive)?
Details and assumptions
Number is considered reachable.
Alan's first step would be to multiply 3 to 1, getting 3, which becomes the current number. Bob then adds either 1 or 2 to the current number (which is 3), depending on the coin toss.
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.
We will consider the numbers created by Alan and Bob in base 3 . If Bob's choices are a 1 , a 2 , . . . , a k , then before Bob's k-th move the number is 1 a 1 a 2 . . . a k − 1 0 and after Bob's k-th move it is 1 a 1 a 2 . . . a k . Since 3 7 > 1 0 0 0 , the maximal length of the number is at most 7 . The smallest seven-digit number that can appear in the game is 1 1 1 1 1 1 0 . It equals 3 6 + 3 5 + 3 4 + 3 3 + 3 2 + 3 1 = 3 − 1 3 ( 3 6 − 1 ) = 1 0 9 2 > 1 0 0 0 Therefore, all reachable numbers up to 1 0 0 0 have six digits or less in base 3 . Since they only have 6 digits in base 3, they will be less than 3 6 = 7 2 9 , hence are less than 1000. The first digit is fixed at 1 , the second through fifth digits can be 1 or 2 and the last digit can be 0 , 1 or 2 . This gives 2 4 ⋅ 3 possibilities. Similarly, there are 2 3 ⋅ 3 five-digit numbers, 2 2 ⋅ 3 four-digit numbers, 2 ⋅ 3 three-digit numbers, 3 two-digit numbers and 1 one-digit number ( 1 itself). So the grand total is 2 4 ⋅ 3 + 2 3 ⋅ 3 + 2 2 ⋅ 3 + 2 ⋅ 3 + 3 + 1 = 9 4