I am thinking of a positive number X. To determine what number I am thinking of, I will give you two 1xN vectors. The first vector (V1) is several numbers, none of which will share a factor. The second vector (V2) is the remainder of X when divided by each of the numbers in V1. Calculate what the lowest possible value of X can be given these criteria. For example:
V1 = [2 3] ; V2 = [1 2]
would give an X value of 5. There are an infinite number of other values of X that would satisfy V1 and V2, but I want the lowest one.
I think that there's a bug in the test cases; putting
clear V1;
before test case 7 should fix it.
clear V1 has now been added before test case 7, and the solutions are being rescored. Hopefully, this will fix the problems you were having.
Chinese remainder theorem
http://en.wikipedia.org/wiki/Chinese_remainder_theorem
I have a solution that solves all of the test cases, but when I run it against the test suite it produces "Error using builtin
Undefined function or variable 'solutionTest'." for each case.
Sorry about that...it was only for learning purposes... :-)
1104 Solvers
Sum all integers from 1 to 2^n
6334 Solvers
Determine if input is a perfect number
113 Solvers
Accessing elements on the diagonal
68 Solvers
171 Solvers