Cody

Solution 1285676

Submitted on 12 Oct 2017 by Amol Koli
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

a = 35 r = 3 c = 9 p1 = 5 p2 = 23 a = 45 48 52 r = 5 3 2 c = 9 10 11 p1 = 11 p2 = 23 a = 59 68 r = 5 2 c = 10 12 p1 = 11 p2 = 29 a = 70 87 93 r = 7 3 2 c = 10 13 14 p1 = 17 p2 = 29 a = 89 101 r = 5 3 c = 13 15 p1 = 11 p2 = 41 a = 103 117 123 r = 7 5 3 c = 13 15 16 p1 = 17 p2 = 41 a = 117 133 140 147 155 r = 9 7 5 3 2 c = 13 15 16 17 18 p1 = 23 p2 = 41 a = 135 142 149 164 r = 9 7 5 2 c = 15 16 17 19 p1 = 23 p2 = 47 a = 150 159 167 193 202 r = 10 9 7 3 2 c = 15 16 17 20 21 p1 = 29 p2 = 47

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

a = 18 r = 3 c = 6 p1 = 5 p2 = 13 a = 24 26 r = 4 2 c = 6 7 p1 = 7 p2 = 13 a = 27 30 r = 3 2 c = 7 8 p1 = 5 p2 = 17 a = 238 271 281 290 r = 10 7 5 2 c = 20 23 24 25 p1 = 29 p2 = 71 a = 234 258 270 282 294 305 315 r = 13 11 10 9 8 6 3 c = 18 20 21 22 23 24 25 p1 = 41 p2 = 61 a = 285 299 313 341 367 381 395 409 423 r = 15 14 13 11 7 6 5 4 3 c = 19 20 21 23 25 26 27 28 29 p1 = 47 p2 = 67 a = 8735 9151 9484 9732 9899 9981 10398 10728 11059 11308 11473 11719 11885 12052 12549 12882 13044 13208 13373 13456 13539 13702 13785 13867 14030 r = 83 79 76 72 71 69 66 60 55 52 49 43 41 40 33 30 24 20 17 16 15 10 9 7 2 c = 104 109 113 116 118 119 124 128 132 135 137 140 142 144 150 154 156 158 160 161 162 164 165 166 168 p1 = 431 p2 = 569 a = 28388 29137 29885 30487 30786 31686 32738 33334 33481 33779 34080 34831 34981 36630 37230 37530 38731 38881 39328 39629 39776 40527 41276 41422 41874 42024 42767 43217 44413 45155 45304 45453 r = 151 145 138 136 133 127 122 114 110 106 105 101 100 88 84 82 75 74 68 67 63 59 53 48 47 46 34 31 19 6 4 2 c = 188 193 198 202 204 210 217 221 222 224 226 231 232 243 247 249 257 258 261 263 264 269 274 275 278 279 284 287 295 300 301 302 p1 = 877 p2 = 1123 a = 49 53 r = 4 3 c = 10 11 p1 = 7 p2 = 29 a = 76304 76805 77305 78303 79305 79804 80054 80302 81054 81553 81803 83550 84804 85053 85554 85804 86052 86302 87051 87552 88051 88301 88802 89553 90552 91053 92054 92301 92799 93048 93549 93799 94297 94545 95045 95295 95794 96044 96544 96794 97044 98046 98296 99299 99548 100298 101296 101545 101795 102547 103546 104046 104296 105545 105795 106044 106294 106542 106792 107292 107789 108039 108789 109037 110287 111036 111536 111785 112281 112531 112780 113281 113530 114030 114280 114777 115027 116526 117026 117276 117526 117776 118025 118525 118775 119024 119274 119523 120022 120519 120767 121267 121517 122018 122266 122514 122763 123013 123262 123512 123762 124012 124262 124512 124761 125011 125259 125508 125758 126006 r = 251 250 248 242 240 237 236 233 232 229 228 218 217 215 214 213 210 209 205 204 201 200 199 197 192 191 188 184 180 178 177 176 172 169 167 166 163 162 160 159 158 156 155 154 152 149 143 141 140 139 134 132 131 125 124 122 121 118 117 115 110 109 106 103 98 94 92 90 84 83 81 80 78 76 75 70 69 62 60 59 58 57 55 53 52 50 49 47 44 39 36 34 33 32 29 26 24 23 21 20 19 18 17 16 14 13 10 8 7 4 c = 304 306 308 312 316 318 319 320 323 325 326 333 338 339 341 342 343 344 347 349 351 352 354 357 361 363 367 368 370 371 373 374 376 377 379 380 382 383 385 386 387 391 392 396 397 400 404 405 406 409 413 415 416 421 422 423 424 425 426 428 430 431 434 435 440 443 445 446 448 449 450 452 453 455 456 458 459 465 467 468 469 470 471 473 474 475 476 477 479 481 482 484 485 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 p1 = 1597 p2 = 2003