my solution is correct,, what is the problem
Problem is with the test suite it expects just 2 numbers and you generated vector of all possible solutions, if you return after finding the first pair it will work.
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
p =
2 3 5 7 11 13 17 19 23
p1 =
5 11 17 23
p2 =
23 17 11 5
|
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
p =
2 3 5 7 11 13 17
p1 =
5 7 11 13
p2 =
13 11 7 5
|
Return a list sorted by number of occurrences
1225 Solvers
Increment a number, given its digits
505 Solvers
Back to basics 11 - Max Integer
611 Solvers
185 Solvers
Create a two dimensional zero matrix
275 Solvers