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...
Select every other element of a vector
Find Index of maximum Value and maximum Value of a vector
Sum the Digits of a Number
02 - Vector Variables 2
Fibonacci-Sum of Squares
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