The common factor must be an integer too, or else there is no way to find it without more parameters; defining the step and search interval for instance. Currently, any multiple of 5 would produce a valid "restored vector" for the only available test. The problem also needs a better test suite. It's a good problem.
Doesn't always work, for example when x = 11*[ 5, 7, 32] .
Oops. C itself doesn't have to be an integer. Should have checked the test suite more carefully...
Make the vector [1 2 3 4 5 6 7 8 9 10]
Convert a numerical matrix into a cell array of strings
Permute diagonal and antidiagonal
The Answer to Life, the Universe, and Everything
Min of a Matrix
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office