Cody

Solution 1478024

Submitted on 3 Apr 2018 by Sumeet Gadagkar
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

p2 = 26 p2 = 25 p2 = 23 ans = [] p1 = 5 p2 = 23 p2 = 32 p2 = 31 ans = [] p1 = 3 p2 = 31 p2 = 38 p2 = 37 ans = [] p1 = 3 p2 = 37 p2 = 44 p2 = 43 ans = [] p1 = 3 p2 = 43 p2 = 50 p2 = 49 p2 = 47 ans = [] p1 = 5 p2 = 47 p2 = 56 p2 = 55 p2 = 53 ans = [] p1 = 5 p2 = 53 p2 = 62 p2 = 61 ans = [] p1 = 3 p2 = 61 p2 = 68 p2 = 67 ans = [] p1 = 3 p2 = 67 p2 = 74 p2 = 73 ans = [] p1 = 3 p2 = 73

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

p2 = 16 p2 = 15 p2 = 13 ans = [] p1 = 5 p2 = 13 p2 = 18 p2 = 17 ans = [] p1 = 3 p2 = 17 p2 = 20 p2 = 19 ans = [] p1 = 3 p2 = 19 p2 = 98 p2 = 97 ans = [] p1 = 3 p2 = 97 p2 = 100 p2 = 99 p2 = 97 ans = [] p1 = 5 p2 = 97 p2 = 112 p2 = 111 p2 = 109 ans = [] p1 = 5 p2 = 109 p2 = 998 p2 = 997 ans = [] p1 = 3 p2 = 997 p2 = 1998 p2 = 1997 ans = [] p1 = 3 p2 = 1997 p2 = 34 p2 = 33 p2 = 31 ans = [] p1 = 5 p2 = 31 p2 = 3598 p2 = 3597 p2 = 3595 p2 = 3593 ans = [] p1 = 7 p2 = 3593