Cody

Solution 90853

Submitted on 22 May 2012 by Brett Shoelson
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

combs = 5 23 11 17 p1 = 5 p2 = 23 combs = 3 31 5 29 11 23 p1 = 3 p2 = 31 combs = 3 37 11 29 17 23 p1 = 3 p2 = 37 combs = 3 43 5 41 17 29 p1 = 3 p2 = 43 combs = 5 47 11 41 23 29 p1 = 5 p2 = 47 combs = 5 53 11 47 17 41 p1 = 5 p2 = 53 combs = 3 61 5 59 11 53 17 47 23 41 p1 = 3 p2 = 61 combs = 3 67 11 59 17 53 23 47 29 41 p1 = 3 p2 = 67 combs = 3 73 5 71 17 59 23 53 29 47 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

combs = 5 13 7 11 p1 = 5 p2 = 13 combs = 3 17 7 13 p1 = 3 p2 = 17 combs = 3 19 5 17 p1 = 3 p2 = 19 combs = 3 97 11 89 17 83 29 71 41 59 47 53 p1 = 3 p2 = 97 combs = 5 97 13 89 19 83 23 79 29 73 31 71 41 61 43 59 p1 = 5 p2 = 97 combs = 5 109 7 107 11 103 13 101 17 97 31 83 41 73 43 71 47 67 53 61 p1 = 5 p2 = 109 combs = 3 997 17 983 23 977 29 971 47 953 53 947 59 941 71 929 89 911 113 887 137 863 173 827 179 821 191 809 227 773 239 761 257 743 281 719 317 683 347 653 353 647 359 641 383 617 401 599 431 569 443 557 479 521 491 509 p1 = 3 p2 = 997 combs = 3 1997 7 1993 13 1987 67 1933 127 1873 139 1861 199 1801 211 1789 223 1777 241 1759 277 1723 307 1693 331 1669 337 1663 373 1627 379 1621 421 1579 433 1567 457 1543 541 1459 547 1453 571 1429 577 1423 601 1399 619 1381 673 1327 709 1291 751 1249 769 1231 787 1213 829 1171 877 1123 883 1117 907 1093 937 1063 967 1033 991 1009 p1 = 3 p2 = 1997 combs = 5 31 7 29 13 23 17 19 p1 = 5 p2 = 31 combs = 7 3593 17 3583 19 3581 29 3571 41 3559 43 3557 53 3547 59 3541 61 3539 67 3533 71 3529 73 3527 83 3517 89 3511 101 3499 109 3491 131 3469 137 3463 139 3461 151 3449 167 3433 193 3407 211 3389 227 3373 229 3371 239 3361 241 3359 257 3343 269 3331 271 3329 277 3323 281 3319 293 3307 347 3253 349 3251 379 3221 383 3217 397 3203 409 3191 419 3181 431 3169 433 3167 463 3137 479 3121 491 3109 521 3079 563 3037 577 3023 599 3001 601 2999 631 2969 643 2957 647 2953 661 2939 673 2927 683 2917 691 2909 739 2861 743 2857 757 2843 797 2803 809 2791 811 2789 823 2777 859 2741 881 2719 887 2713 907 2693 911 2689 929 2671 937 2663 941 2659 953 2647 967 2633 983 2617 991 2609 1009 2591 1021 2579 1049 2551 1051 2549 1061 2539 1069 2531 1097 2503 1123 2477 1153 2447 1163 2437 1201 2399 1217 2383 1223 2377 1229 2371 1249 2351 1259 2341 1289 2311 1291 2309 1303 2297 1307 2293 1319 2281 1327 2273 1361 2239 1439 2161 1447 2153 1459 2141 1471 2129 1487 2113 1489 2111 1511 2089 1531 2069 1571 2029 1583 2017 1597 2003 1601 1999 1607 1993 1613 1987 1621 1979 1627 1973 1667 1933 1669 1931 1693 1907 1699 1901 1721 1879 1723 1877 1733 1867 1753 1847 1777 1823 1789 1811 p1 = 7 p2 = 3593