Problem 42377. Bouncy numbers
Inspired by Project Euler n°112.
- 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.
- Similarly if no digit is exceeded by the digit to its right it is called a decreasing number. For example: 66420.
We shall call a positive integer that is neither increasing nor decreasing a bouncy number. For example, 155349.
Clearly there cannot be any bouncy numbers below one-hundred, but surprisingly, these numbers become more and more common after.
Find the least number for which the proportion of bouncy numbers is exactly p%.
As always this type of problem is difficult to solve with usual Matlab functions (num2str).
So keep an eye on time...
Solution Stats
Problem Comments
-
2 Comments
James
on 15 Jun 2015
I think the problem statement should read "the proportion of bouncy numbers is at least p%", rather than "exactly p%."
Rafael S.T. Vieira
on 9 Aug 2020
Currently, num2str is able to handle all test cases.
Solution Comments
Show commentsProblem Recent Solvers36
Suggested Problems
-
It dseon't mettar waht oedrr the lrettes in a wrod are.
1791 Solvers
-
Find the sum of the elements in the "second" diagonal
1147 Solvers
-
Numbers with prime factors 2, 3 and 5.
474 Solvers
-
338 Solvers
-
317 Solvers
More from this Author43
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!