Problem 259
Reachable Numbers
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 minus 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) * ((4*5)-6) * (78-9) = 42.
What is the sum of all positive reachable integers?
可达数
如果正整数可以表示成符合下列规则的算术表达式的结果,就被称为是可达的:
- 按照从小到大顺序使用数字1至9恰好各一次。
- 任意相邻数字可以连接起来使用(例如,将数字2、3、4连接起来得到234)。
- 只能使用四则运算(加法、减法、乘法、除法)。
- 每种运算可以使用任意多次,也可以不用。
- 禁止使用负号。
- 可以使用(甚至嵌套使用)任意数量的括号以规定运算顺序。
例如,42是可达的,因为(1/23) * ((4*5)-6) * (78-9) = 42。
所有可达正整数的和是多少?