Cody

Solution 1428773

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

Suggested Problems

More from this Author95