2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4701000cf542c50ff82
|
|
|
|
challengeType: 5
|
|
|
|
title: 'Problem 259: Reachable Numbers'
|
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
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?
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 13:37:37 +00:00
|
|
|
tests:
|
|
|
|
- text: <code>euler259()</code> should return 20101196798.
|
2018-10-08 00:01:53 +00:00
|
|
|
testString: 'assert.strictEqual(euler259(), 20101196798, "<code>euler259()</code> should return 20101196798.");'
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function euler259() {
|
|
|
|
// Good luck!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler259();
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
|
|
|
</section>
|