Cody

Problem 64. The Goldbach Conjecture, Part 2

Solution 1849503

Submitted on 14 Jun 2019 by Emma Moore
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
n = 6; c_correct = 1; assert(isequal(goldbach2(n),c_correct))

p = 2 3 5 rem = 4 c = 0 c = 1 rem = 1 c = 1

2   Pass
n = 10; c_correct = 2; assert(isequal(goldbach2(n),c_correct))

p = 2 3 5 7 rem = 8 c = 0 rem = 7 currenttotal = 1 count = 1 c = 0.5000 c = 1.5000 rem = 3 currenttotal = 3 count = 2 c = 2

3   Pass
n = 50; c_correct = 4; assert(isequal(goldbach2(n),c_correct))

p = 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 rem = 48 c = 0 rem = 47 currenttotal = 1 count = 1 c = 0.5000 rem = 45 c = 0.5000 rem = 43 currenttotal = 2 count = 2 c = 1 rem = 39 c = 1 rem = 37 currenttotal = 3 count = 3 c = 1.5000 rem = 33 c = 1.5000 rem = 31 currenttotal = 4 count = 4 c = 2 rem = 27 c = 2 rem = 21 c = 2 rem = 19 currenttotal = 5 count = 5 c = 2.5000 rem = 13 currenttotal = 6 count = 6 c = 3 rem = 9 c = 3 rem = 7 currenttotal = 7 count = 7 c = 3.5000 rem = 3 currenttotal = 8 count = 8 c = 4

4   Pass
n = 480; c_correct = 29; assert(isequal(goldbach2(n),c_correct))

p = Columns 1 through 30 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 Columns 31 through 60 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 Columns 61 through 90 283 293 307 311 313 317 331 337 347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 Columns 91 through 92 467 479 rem = 478 c = 0 rem = 477 c = 0 rem = 475 c = 0 rem = 473 c = 0 rem = 469 c = 0 rem = 467 currenttotal = 1 count = 1 c = 0.5000 rem = 463 currenttotal = 2 count = 2 c = 1 rem = 461 currenttotal = 3 count = 3 c = 1.5000 rem = 457 currenttotal = 4 count = 4 c = 2 rem = 451 c = 2 rem = 449 currenttotal = 5 count = 5 c = 2.5000 rem = 443 currenttotal = 6 count = 6 c = 3 rem = 439 currenttotal = 7 count = 7 c = 3.5000 rem = 437 c = 3.5000 rem = 433 currenttotal = 8 count = 8 c = 4 rem = 427 c = 4 rem = 421 currenttotal = 9 count = 9 c = 4.5000 rem = 419 currenttotal = 10 count = 10 c = 5 rem = 413 c = 5 rem = 409 currenttotal = 11 count = 11 c = 5.5000 rem = 407 c = 5.5000 rem = 401 currenttotal = 12 count = 12 c = 6 rem = 397 currenttotal = 13 count = 13 c = 6.5000 rem = 391 c = 6.5000 rem = 383 currenttotal = 14 count = 14 c = 7 rem = 379 currenttotal = 15 count = 15 c = 7.5000 rem = 377 c = 7.5000 rem = 373 currenttotal = 16 count = 16 c = 8 rem = 371 c = 8 rem = 367 currenttotal = 17 count = 17 c = 8.5000 rem = 353 currenttotal = 18 count = 18 c = 9 rem = 349 currenttotal = 19 count = 19 c = 9.5000 rem = 343 c = 9.5000 rem = 341 c = 9.5000 rem = 331 currenttotal = 20 count = 20 c = 10 rem = 329 c = 10 rem = 323 c = 10 rem = 317 currenttotal = 21 count = 21 c = 10.5000 rem = 313 currenttotal = 22 count = 22 c = 11 rem = 307 currenttotal = 23 count = 23 c = 11.5000 rem = 301 c = 11.5000 rem = 299 c = 11.5000 rem = 289 c = 11.5000 rem = 287 c = 11.5000 rem = 283 currenttotal = 24 count = 24 c = 12 rem = 281 currenttotal = 25 count = 25 c = 12.5000 rem = 269 currenttotal = 26 count = 26 c = 13 rem = 257 currenttotal = 27 count = 27 c = 13.5000 rem = 253 c = 13.5000 rem = 251 currenttotal = 28 count = 28 c = 14 rem = 247 c = 14 rem = 241 currenttotal = 29 count = 29 c = 14.5000 rem = 239 currenttotal = 30 count = 30 c = 15 rem = 229 currenttotal = 31 count = 31 c = 15.5000 rem = 223 currenttotal = 32 count = 32 c = 16 rem = 217 c = 16 rem = 211 currenttotal = 33 count = 33 c = 16.5000 rem = 209 c = 16.5000 rem = 203 c = 16.5000 rem = 199 currenttotal = 34 count = 34 c = 17 rem = 197 currenttotal = 35 count = 35 c = 17.5000 rem = 187 c = 17.5000 rem = 173 currenttotal = 36 count = 36 c = 18 rem = 169 c = 18 rem = 167 currenttotal = 37 count = 37 c = 18.5000 rem = 163 currenttotal = 38 count = 38 c = 19 rem = 149 currenttotal = 39 count = 39 c = 19.5000 rem = 143 c = 19.5000 rem = 133 c = 19.5000 rem = 131 currenttotal = 40 count = 40 c = 20 rem = 127 currenttotal = 41 count = 41 c = 20.5000 rem = 121 c = 20.5000 rem = 113 currenttotal = 42 count = 42 c = 21 rem = 107 currenttotal = 43 count = 43 c = 21.5000 rem = 101 currenttotal = 44 count = 44 c = 22 rem = 97 currenttotal = 45 count = 45 c = 22.5000 rem = 91 c = 22.5000 rem = 83 currenttotal = 46 count = 46 c = 23 rem = 79 currenttotal = 47 count = 47 c = 23.5000 rem = 71 currenttotal = 48 count = 48 c = 24 rem = 61 currenttotal = 49 count = 49 c = 24.5000 rem = 59 currenttotal = 50 count = 50 c = 25 rem = 49 c = 25 rem = 47 currenttotal = 51 count = 51 c = 25.5000 rem = 41 currenttotal = 52 count = 52 c = 26 rem = 37 currenttotal = 53 count = 53 c = 26.5000 rem = 31 currenttotal = 54 count = 54 c = 27 rem = 23 currenttotal = 55 count = 55 c = 27.5000 rem = 19 currenttotal = 56 count = 56 c = 28 rem = 17 currenttotal = 57 count = 57 c = 28.5000 rem = 13 currenttotal = 58 count = 58 c = 29 rem = 1 c = 29