Cody

Solution 3079

Submitted on 26 Jan 2012 by A Millo
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

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

p1 = 5 7 11 13 p1 = 5 p2 = 13 p1 = 3 7 13 17 p1 = 3 p2 = 17 p1 = 3 5 11 17 19 p1 = 3 p2 = 19 p1 = Columns 1 through 10 3 11 17 29 41 47 53 59 71 83 Columns 11 through 12 89 97 p1 = 3 p2 = 97 p1 = Columns 1 through 10 5 13 19 23 29 31 41 43 59 61 Columns 11 through 16 71 73 79 83 89 97 p1 = 5 p2 = 97 p1 = Columns 1 through 10 5 7 11 13 17 31 41 43 47 53 Columns 11 through 20 61 67 71 73 83 97 101 103 107 109 p1 = 5 p2 = 109 p1 = Columns 1 through 10 3 17 23 29 47 53 59 71 89 113 Columns 11 through 20 137 173 179 191 227 239 257 281 317 347 Columns 21 through 30 353 359 383 401 431 443 479 491 509 521 Columns 31 through 40 557 569 599 617 641 647 653 683 719 743 Columns 41 through 50 761 773 809 821 827 863 887 911 929 941 Columns 51 through 56 947 953 971 977 983 997 p1 = 3 p2 = 997 p1 = Columns 1 through 5 3 7 13 67 127 Columns 6 through 10 139 199 211 223 241 Columns 11 through 15 277 307 331 337 373 Columns 16 through 20 379 421 433 457 541 Columns 21 through 25 547 571 577 601 619 Columns 26 through 30 673 709 751 769 787 Columns 31 through 35 829 877 883 907 937 Columns 36 through 40 967 991 1009 1033 1063 Columns 41 through 45 1093 1117 1123 1171 1213 Columns 46 through 50 1231 1249 1291 1327 1381 Columns 51 through 55 1399 1423 1429 1453 1459 Columns 56 through 60 1543 1567 1579 1621 1627 Columns 61 through 65 1663 1669 1693 1723 1759 Columns 66 through 70 1777 1789 1801 1861 1873 Columns 71 through 74 1933 1987 1993 1997 p1 = 3 p2 = 1997 p1 = 5 7 13 17 19 23 29 31 p1 = 5 p2 = 31 p1 = Columns 1 through 5 7 17 19 29 41 Columns 6 through 10 43 53 59 61 67 Columns 11 through 15 71 73 83 89 101 Columns 16 through 20 109 131 137 139 151 Columns 21 through 25 167 193 211 227 229 Columns 26 through 30 239 241 257 269 271 Columns 31 through 35 277 281 293 347 349 Columns 36 through 40 379 383 397 409 419 Columns 41 through 45 431 433 463 479 491 Columns 46 through 50 521 563 577 599 601 Columns 51 through 55 631 643 647 661 673 Columns 56 through 60 683 691 739 743 757 Columns 61 through 65 797 809 811 823 859 Columns 66 through 70 881 887 907 911 929 Columns 71 through 75 937 941 953 967 983 Columns 76 through 80 991 1009 1021 1049 1051 Columns 81 through 85 1061 1069 1097 1123 1153 Columns 86 through 90 1163 1201 1217 1223 1229 Columns 91 through 95 1249 1259 1289 1291 1303 Columns 96 through 100 1307 1319 1327 1361 1439 Columns 101 through 105 1447 1459 1471 1487 1489 Columns 106 through 110 1511 1531 1571 1583 1597 Columns 111 through 115 1601 1607 1613 1621 1627 Columns 116 through 120 1667 1669 1693 1699 1721 Columns 121 through 125 1723 1733 1753 1777 1789 Columns 126 through 130 1811 1823 1847 1867 1877 Columns 131 through 135 1879 1901 1907 1931 1933 Columns 136 through 140 1973 1979 1987 1993 1999 Columns 141 through 145 2003 2017 2029 2069 2089 Columns 146 through 150 2111 2113 2129 2141 2153 Columns 151 through 155 2161 2239 2273 2281 2293 Columns 156 through 160 2297 2309 2311 2341 2351 Columns 161 through 165 2371 2377 2383 2399 2437 Columns 166 through 170 2447 2477 2503 2531 2539 Columns 171 through 175 2549 2551 2579 2591 2609 Columns 176 through 180 2617 2633 2647 2659 2663 Columns 181 through 185 2671 2689 2693 2713 2719 Columns 186 through 190 2741 2777 2789 2791 2803 Columns 191 through 195 2843 2857 2861 2909 2917 Columns 196 through 200 2927 2939 2953 2957 2969 Columns 201 through 205 2999 3001 3023 3037 3079 Columns 206 through 210 3109 3121 3137 3167 3169 Columns 211 through 215 3181 3191 3203 3217 3221 Columns 216 through 220 3251 3253 3307 3319 3323 Columns 221 through 225 3329 3331 3343 3359 3361 Columns 226 through 230 3371 3373 3389 3407 3433 Columns 231 through 235 3449 3461 3463 3469 3491 Columns 236 through 240 3499 3511 3517 3527 3529 Columns 241 through 245 3533 3539 3541 3547 3557 Columns 246 through 250 3559 3571 3581 3583 3593 p1 = 7 p2 = 3593