Cody

Solution 1639935

Submitted on 8 Oct 2018 by Philippe S.
  • Size: 8
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 28 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 34 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 40 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 46 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 52 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 58 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 64 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 70 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint1 (line 4) In solutionTest (line 3)] p1 = 0 p2 = 76

2   Pass
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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 18 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 20 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 22 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 100 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 102 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 114 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 1000 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 2000 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 36 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In goldbach (line 2) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] p1 = 0 p2 = 3600

Suggested Problems