Inspired by Problem 42831, this problem aims to calculate the integer complexity for large numbers. The integer complexity of a natural number n is defined as the least number of 1’s required to express n using only the two operations + and × and parentheses.
Example: the number 11 may be represented using 8 ones:
11 = (1 + 1 + 1) × (1 + 1 + 1) + 1 + 1.
However, it has no representation using 7 or fewer ones. Therefore, its complexity is 8.
Your solution will be scored based on its running time. No cheating please.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers23
Suggested Problems
-
The Hitchhiker's Guide to MATLAB
3401 Solvers
-
Make a run-length companion vector
656 Solvers
-
344 Solvers
-
211 Solvers
-
compress sequence into intervals
98 Solvers
More from this Author28
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!