A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
Uses the digits $1$ through $9$, in that order and exactly once each.
Any successive digits can be concatenated (for example, using the digits $2$, $3$ and $4$ we obtain the number $234$).
Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed.
Each operation can be used any number of times, or not at all.
Unary minusA minus sign applied to a single operand (as opposed to a subtraction operator between two operands) is not allowed.
Any number of (possibly nested) parentheses may be used to define the order of operations.
For example, $42$ is reachable, since $(1 / 23) \times ((4 \times 5) – 6) \times (78 – 9) = 42$.
What is the sum of all positive reachable integers?
The sum of all positive reachable integers is 42579.
First, if any of the binary operations are performed to the number 1, then we obtain a smaller positive integer. Thus the largest positive reachable integer is 123456789.
Next, we claim that if n is a positive integer less than 123456789, then n and 123456789 – n are both reachable. Assume the contrary, then for some such n, suppose n is reachable and 123456789 – n is not.
We construct an arithmetic expression for n which does not use any number in the decimal representation of 123456789 – n. Then add the last number (that is not in the decimal representation of 123456789 – n) arbitrarily to construct 123456789 – n. Now n can be constructed by subtracting from 123456789, and we have a contradiction.
On the other hand, we can construct any positive integer n by subtracting from 123456789. This completes the proof of the claim.
Hence, the answer is $(123456789 + 1)(123456789/2) = \boxed{4257970691890}$.
Note that some numbers, such as 4, 7, 8, … cannot be written as $123456789 – n$ where $n$ is reachable. It’s because the numbers that are too small cannot be formed just by concatenating and subtracting. However, this doesn’t affect the validity of the solution because both $n$ and $123456789 – n$ were counted anyways.
More Answers:
Rounded Square RootsTatami-Free Rooms
A Lagged Fibonacci Sequence