It would be interesting that the test suite does the assertion on all entries of p1 & p2 in case they return all possible solutions.
assert(all(isprime(p1) & isprime(p2) & (p1+p2==n))
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
%%
nList = 28:6:76;
for i = 1:length(nList)
n = nList(i);
[p1,p2] = goldbach(n)
assert(isprime(p1) && isprime(p2) && (p1+p2==n));
end
Error: Operands to the || and && operators must be convertible to logical scalar values.
|
2 | Fail |
%%
nList = [18 20 22 100 102 114 1000 2000 36 3600];
for i = 1:length(nList)
n = nList(i);
[p1,p2] = goldbach(n)
assert(isprime(p1) && isprime(p2) && (p1+p2==n));
end
Error: Operands to the || and && operators must be convertible to logical scalar values.
|
Find the sum of all the numbers of the input vector
25604 Solvers
Are all the three given point in the same line?
197 Solvers
Detect a number and replace with two NaN's
157 Solvers
311 Solvers
168 Solvers