Cody

# Problem 590. Greed is good - Simple partition P[n].

Solution 400173

Submitted on 10 Feb 2014 by Zikobrelli
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
%% x = 10000; y_correct = x; z = simplepartition(x); zL = length(z); assert(isequal(sum(unique(z)),y_correct) && zL >= ceil(log2(x)/2)) x = 40190; y_correct = x; z = simplepartition(x); zL = length(z); assert(isequal(sum(unique(z)),y_correct) && zL >= ceil(log2(x)/2)) x = 149; y_correct = x; z = simplepartition(x); zL = length(z); assert(isequal(sum(unique(z)),y_correct) && zL >= ceil(log2(x)/2))

ans = Columns 1 through 8 10000 10000 10000 10000 10000 10000 10000 10000 Columns 9 through 16 10000 10000 10000 10000 10000 10000 10000 10000 Columns 17 through 24 10000 10000 10000 10000 10000 10000 10000 10000 Columns 25 through 32 10000 10000 10000 10000 10000 10000 10000 10000 Columns 33 through 40 10000 10000 10000 10000 10000 10000 10000 10000 Columns 41 through 48 10000 10000 10000 10000 10000 10000 10000 10000 Columns 49 through 56 10000 10000 10000 10000 10000 10000 10000 10000 Columns 57 through 64 10000 10000 10000 10000 10000 10000 10000 10000 Columns 65 through 72 10000 10000 10000 10000 10000 10000 10000 10000 Columns 73 through 80 10000 10000 10000 10000 10000 10000 10000 10000 Columns 81 through 88 10000 10000 10000 10000 10000 10000 10000 10000 Columns 89 through 96 10000 10000 10000 10000 10000 10000 10000 10000 Columns 97 through 104 10000 10000 10000 10000 10000 10000 10000 10000 Columns 105 through 112 10000 10000 10000 10000 10000 10000 10000 10000 Columns 113 through 120 10000 10000 10000 10000 10000 10000 10000 10000 Columns 121 through 128 10000 10000 10000 10000 10000 10000 10000 10000 Columns 129 through 136 10000 10000 10000 10000 10000 10000 10000 10000 Columns 137 through 144 10000 10000 10000 10000 10000 10000 10000 10000 Columns 145 through 152 10000 10000 10000 10000 10000 10000 10000 10000 Columns 153 through 160 10000 10000 10000 10000 10000 10000 10000 10000 Columns 161 through 168 10000 10000 10000 10000 10000 10000 10000 10000 Columns 169 through 176 10000 10000 10000 10000 10000 10000 10000 10000 Columns 177 through 184 10000 10000 10000 10000 10000 10000 10000 10000 Columns 185 through 192 10000 10000 10000 10000 10000 10000 10000 10000 Columns 193 through 200 10000 10000 10000 10000 10000 10000 10000 10000 Columns 201 through 208 10000 10000 10000 10000 10000 10000 10000 10000 Columns 209 through 216 10000 10000 10000 10000 10000 10000 10000 10000 Columns 217 through 224 10000 10000 10000 10000 10000 10000 10000 10000 Columns 225 through 232 10000 10000 10000 10000 10000 10000 10000 10000 Columns 233 through 240 10000 10000 10000 10000 10000 10000 10000 10000 Columns 241 through 248 10000 10000 10000 10000 10000 10000 10000 10000 Columns 249 through 256 10000 10000 10000 10000 10000 10000 10000 10000 Columns 257 through 264 10000 10000 10000 10000 10000 10000 10000 10000 Columns 265 through 272 10000 10000 10000 10000 10000 10000 10000 10000 Columns 273 through 280 10000 10000 10000 10000 10000 10000 10000 10000 Columns 281 through 288 10000 10000 10000 10000 10000 10000 10000 10000 Columns 289 through 296 10000 10000 10000 10000 10000 10000 10000 10000 Columns 297 through 304 10000 10000 10000 10000 10000 10000 10000 10000 Columns 305 through 312 10000 10000 10000 10000 10000 10000 10000 10000 Columns 313 through 320 10000 10000 10000 10000 10000 10000 10000 10000 Columns 321 through 328 10000 10000 10000 10000 10000 10000 10000 10000 Columns 329 through 336 10000 10000 10000 10000 10000 10000 10000 10000 Columns 337 through 344 10000 10000 10000 10000 10000 10000 10000 10000 Columns 345 through 352 10000 10000 10000 10000 10000 10000 10000 10000 Columns 353 through 360 10000 10000 10000 10000 10000 10000 10000 10000 Columns 361 through 368 10000 10000 10000 10000 10000 10000 10000 10000 Columns 369 through 376 10000 10000 10000 10000 10000 10000 10000 10000 Columns 377 through 384 10000 10000 10000 10000 10000 10000 10000 10000 Columns 385 through 392 10000 10000 10000 10000 10000 10000 10000 10000 Columns 393 through 400 10000 10000 10000 10000 10000 10000 10000 10000 Columns 401 through 408 10000 10000 10000 10000 10000 10000 10000 10000 Columns 409 through 416 10000 10000 10000 10000 10000 10000 10000 10000 Columns 417 through 424 10000 10000 10000 10000 10000 10000 10000 10000 Columns 425 through 432 10000 10000 10000 10000 10000 10000 10000 10000 Columns 433 through 440 10000 10000 10000 10000 10000 10000 10000 10000 Columns 441 through 448 10000 10000 10000 10000 10000 10000 10000 10000 Columns 449 through 456 10000 10000 10000 10000 10000 10000 10000 10000 Columns 457 through 464 10000 10000 10000 10000 10000 10000 10000 10000 Columns 465 through 472 10000 10000 10000 10000 10000 10000 10000 10000 Columns 473 through 480 10000 10000 10000 10000 10000 10000 10000 10000 Columns 481 through 488 10000 10000 10000 10000 10000 10000 10000 10000 Columns 489 through 496 10000 10000 10000 10000 10000 10000 10000 10000 Columns 497 through 504 10000 10000 10000 10000 10000 10000 10000 10000 Columns 505 through 512 10000 10000 10000 10000 10000 10000 10000 10000 Columns 513 through 520 10000 10000 10000 10000 10000 10000 10000 10000 Columns 521 through 528 10000 10000 10000 10000 10000 10000 10000 10000 Columns 529 through 536 10000 10000 10000 10000 10000 10000 10000 10000 Columns 537 through 544 10000 10000 10000 10000 10000 10000 10000 10000 Columns 545 through 552 10000 10000 10000 10000 10000 10000 10000 10000 Columns 553 through 560 10000 10000 10000 10000 10000 10000 10000 10000 Columns 561 through 568 10000 10000 10000 10000 10000 10000 10000 10000 Columns 569 through 576 10000 10000 10000 10000 10000 10000 10000 10000 Columns 577 through 584 10000 10000 10000 10000 10000 10000 10000 10000 Columns 585 through 592 10000 10000 10000 10000 10000 10000 10000 10000 Columns 593 through 600 10000 10000 10000 10000 10000 10000 10000 10000 Columns 601 through 608 10000 10000 10000 10000 10000 10000 10000 10000 Columns 609 through 616 10000 10000 10000 10000 10000 10000 10000 10000 Columns 617 through 624 10000 10000 10000 10000 10000 10000 10000 10000 Columns 625 through 632 10000 10000 10000 10000 10000 10000 10000 10000 Columns 633 through 640 10000 10000 10000 10000 10000 10000 10000 10000 Columns 641 through 648 10000 10000 10000 10000 10000 10000 10000 10000 Columns 649 through 656 10000 10000 1...