PROJECT EULER · #0259
Reachable Numbers
A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
- Uses the digits
through , in that order and exactly once each. - Any successive digits can be concatenated (for example, using the digits
, and we obtain the number ). - 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,
What is the sum of all positive reachable integers?
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.