2018-09-30 22:01:58 +00:00
---
id: 5900f3dd1000cf542c50feef
title: 'Problem 112: Bouncy numbers'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301738
2021-01-13 02:31:00 +00:00
dashedName: problem-112-bouncy-numbers
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
We shall call a positive integer that is neither increasing nor decreasing a "bouncy" number; for example, 155349.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
Clearly there cannot be any bouncy numbers below one-hundred, but just over half of the numbers below one-thousand (525) are bouncy. In fact, the least number for which the proportion of bouncy numbers first reaches 50% is 538.
2020-11-27 18:02:05 +00:00
Surprisingly, bouncy numbers become more and more common and by the time we reach 21780 the proportion of bouncy numbers is equal to 90%.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Find the least number for which the proportion of bouncy numbers is exactly 99%.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
`euler112()` should return 1587000.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.strictEqual(euler112(), 1587000);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
function euler112() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
euler112();
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```