Problem 58977. Find the smallest number leading to a maximal product of two numbers that concatenate to another number
Cody Problem 58971 involves the maximal product of numbers that concatenate to a number n. For example, if , then the products are , , and , and the maximal product is 492. For , the maximal product is zero.
This problem seeks the smallest number leading to a given maximal product. If the product is 492, the smallest number is 682. Some products have no solution. For example, 13 is a product of both 113 and 131, but the maximal products are 33 and 31, respectively.
Write a function that takes a maximal product and returns the smallest number leading to that product. If the product has no corresponding number, return the empty set.
Solution Stats
Problem Comments
-
3 Comments
CXD
on 19 Sep 2023
For test 17, the answer is 25*84902258=2122556450, but not 303222350*7=2122556450
Christian Schröder
on 19 Sep 2023
@CXD but 2584902258 can be split as 2584*902258 = 2331434672, so it doesn't yield the desired maximal product.
CXD
on 21 Sep 2023
Thanks @Christian Schröder
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
370 Solvers
-
Make a run-length companion vector
638 Solvers
-
Return a list sorted by number of consecutive occurrences
358 Solvers
-
702 Solvers
-
Matrix rotation as per given angle
113 Solvers
More from this Author272
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!