Cody

Problem 44360. Pentagonal Numbers

Solution 1303285

Submitted on 20 Oct 2017 by Foufa.h
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
x1 = 1; x2 = 25; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22])) assert(isequal(d,[0,1,0,0]))

g = [] j = 1 y = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 x0 = 1 f = 1 Lia = logical 1 g = 1 j = 2 f = 1 5 Lia = 1×2 logical array 1 1 g = 1 5 j = 3 f = 1 5 12 Lia = 1×3 logical array 1 1 1 g = 1 5 12 j = 4 f = 1 5 12 22 Lia = 1×4 logical array 1 1 1 1 g = 1 5 12 22 j = 5 f = 1 5 12 22 35 Lia = 1×5 logical array 1 1 1 1 0 f = 1 5 12 22 35 51 Lia = 1×6 logical array 1 1 1 1 0 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 1 1 1 1 0 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 1 1 1 1 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 1 1 1 1 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 1 1 1 1 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 1 1 1 1 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 1 1 1 1 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 Lia = 1×21 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 Lia = 1×22 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 Lia = 1×23 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 Lia = 1×24 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 Lia = 1×25 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 Lia = 1×26 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 Lia = 1×27 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 Lia = 1×28 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 Lia = 1×29 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Lia = 1×30 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 Lia = 1×31 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 Lia = 1×32 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 Lia = 1×33 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 34 1426 1520 1617 1717 Lia = 1×34 logical array 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 24...

2   Pass
x1 = 1; x2 = 4; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,1)) assert(isequal(d,0))

g = [] j = 1 y = 1 2 3 4 x0 = 1 f = 1 Lia = logical 1 g = 1 j = 2 f = 1 5 Lia = 1×2 logical array 1 0 f = 1 5 12 Lia = 1×3 logical array 1 0 0 f = 1 5 12 22 Lia = 1×4 logical array 1 0 0 0 f = 1 5 12 22 35 Lia = 1×5 logical array 1 0 0 0 0 f = 1 5 12 22 35 51 Lia = 1×6 logical array 1 0 0 0 0 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 1 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 1 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 1 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 1 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 1 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 1 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 Lia = 1×21 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 Lia = 1×22 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 Lia = 1×23 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 Lia = 1×24 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 Lia = 1×25 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 Lia = 1×26 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 Lia = 1×27 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 Lia = 1×28 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 Lia = 1×29 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Lia = 1×30 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 Lia = 1×31 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 Lia = 1×32 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 Lia = 1×33 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 34 1426 1520 1617 1717 Lia = 1×34 logical array 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31...

3   Pass
x1 = 10; x2 = 40; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35])) assert(isequal(d,[0,0,1]))

g = [] j = 1 y = Columns 1 through 30 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 Column 31 40 x0 = 10 f = 1 Lia = logical 0 f = 1 5 Lia = 1×2 logical array 0 0 f = 1 5 12 Lia = 1×3 logical array 0 0 1 g = 12 j = 2 f = 1 5 12 22 Lia = 1×4 logical array 0 0 1 1 g = 12 22 j = 3 f = 1 5 12 22 35 Lia = 1×5 logical array 0 0 1 1 1 g = 12 22 35 j = 4 f = 1 5 12 22 35 51 Lia = 1×6 logical array 0 0 1 1 1 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 0 0 1 1 1 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 0 0 1 1 1 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 0 0 1 1 1 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 0 0 1 1 1 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 0 0 1 1 1 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 0 0 1 1 1 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 Lia = 1×21 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 Lia = 1×22 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 Lia = 1×23 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 Lia = 1×24 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 Lia = 1×25 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 Lia = 1×26 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 Lia = 1×27 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 Lia = 1×28 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 Lia = 1×29 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Lia = 1×30 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 Lia = 1×31 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 Lia = 1×32 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 Lia = 1×33 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 34 1426 1520 1617 1717 Lia = 1×34 logical array 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 ...

4   Pass
x1 = 10; x2 = 99; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[12,22,35,51,70,92])) assert(isequal(d,[0,0,1,0,1,0]))

g = [] j = 1 y = Columns 1 through 30 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 Columns 31 through 60 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 Columns 61 through 90 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 x0 = 10 f = 1 Lia = logical 0 f = 1 5 Lia = 1×2 logical array 0 0 f = 1 5 12 Lia = 1×3 logical array 0 0 1 g = 12 j = 2 f = 1 5 12 22 Lia = 1×4 logical array 0 0 1 1 g = 12 22 j = 3 f = 1 5 12 22 35 Lia = 1×5 logical array 0 0 1 1 1 g = 12 22 35 j = 4 f = 1 5 12 22 35 51 Lia = 1×6 logical array 0 0 1 1 1 1 g = 12 22 35 51 j = 5 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 0 0 1 1 1 1 1 g = 12 22 35 51 70 j = 6 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 0 0 1 1 1 1 1 1 g = 12 22 35 51 70 92 j = 7 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 0 0 1 1 1 1 1 1 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 0 0 1 1 1 1 1 1 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 0 0 1 1 1 1 1 1 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 0 0 1 1 1 1 1 1 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 Lia = 1×21 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 Lia = 1×22 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 Lia = 1×23 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 Lia = 1×24 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 Lia = 1×25 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 Lia = 1×26 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 Lia = 1×27 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 Lia = 1×28 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 Lia = 1×29 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Lia = 1×30 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 Lia = 1×31 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 Lia = 1×32 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 Lia = 1×33 logical array 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 ...

5   Pass
x1 = 100; x2 = 999; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1]))

g = [] j = 1 y = Columns 1 through 30 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 Columns 31 through 60 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 Columns 61 through 90 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 Columns 91 through 120 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 Columns 121 through 150 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 Columns 151 through 180 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 Columns 181 through 210 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 Columns 211 through 240 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 Columns 241 through 270 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 Columns 271 through 300 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 Columns 301 through 330 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 Columns 331 through 360 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 Columns 361 through 390 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 Columns 391 through 420 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 Columns 421 through 450 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 Columns 451 through 480 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 Columns 481 through 510 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 Columns 511 through 540 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 Columns 541 through 570 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 Columns 571 through 600 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 Columns 601 through 630 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 Columns 631 through 660 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 Columns 661 through 690 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 Columns 691 through 720 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 Columns 721 through 750 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 Columns 751 through 780 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 Columns 781 through 810 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 Columns 811 through 840 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 Columns 841 through 870 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 Columns 871 through 900 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 x0 = 100 f = 1 Lia = logical 0 f = 1 5 Lia = 1×2 logical array 0 0 f = 1 5 12 Lia = 1×3 logical array 0 0 0 f = 1 5 12 22 Lia = 1×4 logical array 0 0 0 0 f = 1 5 12 22 35 Lia = 1×5 logical array 0 0 0 0 0 f = 1 5 12 22 35 51 Lia = 1×6 logical array 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 0 0 0 0 0 0 0 0 1 g = 117 j = 2 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 0 0 0 0 0 0 0 0 1 1 g = 117 145 j = 3 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 0 0 0 0 0 0 0 0 1 1 1 g = 117 145 176 j = 4 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 0 0 0 0 0 0 0 0 1 1 1 1 g = 117 145 176 210 j = 5 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 g = 117 145 176 210 247 j = 6 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 g = 117 145 176 210 247 287 j = 7 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 j = 8 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 376 j = 9 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 376 425 j = 10 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 376 425 477 j = 11 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 376 425 477 532 j = 12 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 g = 117 145 176 210 247 287 330 376 425 477 532 590 j = 13 f = 1 5 12 22 35 51 70 92 117 145 176 2...

6   Pass
x1 = 40; x2 = 50; [p,d] = pentagonal_numbers(x1,x2) assert(isempty(p)) assert(isempty(d))

g = [] j = 1 y = 40 41 42 43 44 45 46 47 48 49 50 x0 = 40 f = 1 Lia = logical 0 f = 1 5 Lia = 1×2 logical array 0 0 f = 1 5 12 Lia = 1×3 logical array 0 0 0 f = 1 5 12 22 Lia = 1×4 logical array 0 0 0 0 f = 1 5 12 22 35 Lia = 1×5 logical array 0 0 0 0 0 f = 1 5 12 22 35 51 Lia = 1×6 logical array 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 Lia = 1×21 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 Lia = 1×22 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 Lia = 1×23 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 Lia = 1×24 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 Lia = 1×25 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 26 376 425 477 532 590 651 715 782 852 925 1001 Lia = 1×26 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 27 376 425 477 532 590 651 715 782 852 925 1001 1080 Lia = 1×27 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 28 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 Lia = 1×28 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 29 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 Lia = 1×29 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Lia = 1×30 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Column 31 1426 Lia = 1×31 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 32 1426 1520 Lia = 1×32 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 33 1426 1520 1617 Lia = 1×33 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 Columns 31 through 34 1426 1520 1617 1717 Lia = 1×34 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = Columns 1 through 15 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Columns 16 through 30 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335...

7   Pass
x1 = 1000; x2 = 1500; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1001,1080,1162,1247,1335,1426])) assert(isequal(d,[0,1,0,0,1,0]))

g = [] j = 1 y = Columns 1 through 15 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 Columns 16 through 30 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 Columns 31 through 45 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 Columns 46 through 60 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 Columns 61 through 75 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 Columns 76 through 90 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 Columns 91 through 105 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 Columns 106 through 120 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 Columns 121 through 135 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 Columns 136 through 150 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 Columns 151 through 165 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 Columns 166 through 180 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 Columns 181 through 195 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 Columns 196 through 210 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 Columns 211 through 225 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 Columns 226 through 240 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 Columns 241 through 255 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 Columns 256 through 270 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 Columns 271 through 285 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 Columns 286 through 300 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 Columns 301 through 315 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 Columns 316 through 330 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 Columns 331 through 345 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 Columns 346 through 360 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 Columns 361 through 375 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 Columns 376 through 390 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 Columns 391 through 405 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 Columns 406 through 420 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 Columns 421 through 435 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 Columns 436 through 450 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 Columns 451 through 465 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 Columns 466 through 480 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 Columns 481 through 495 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 Columns 496 through 501 1495 1496 1497 1498 1499 1500 x0 = 1000 f = 1 Lia = logical 0 f = 1 5 Lia = 1×2 logical array 0 0 f = 1 5 12 Lia = 1×3 logical array 0 0 0 f = 1 5 12 22 Lia = 1×4 logical array 0 0 0 0 f = 1 5 12 22 35 Lia = 1×5 logical array 0 0 0 0 0 f = 1 5 12 22 35 51 Lia = 1×6 logical array 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 Lia = 1×7 logical array 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 Lia = 1×8 logical array 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 Lia = 1×9 logical array 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 Lia = 1×10 logical array 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 Lia = 1×11 logical array 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 Lia = 1×12 logical array 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 Lia = 1×13 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 Lia = 1×14 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 Lia = 1×15 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 Lia = 1×16 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 Lia = 1×17 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 Lia = 1×18 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 Lia = 1×19 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 Lia = 1×20 logical array 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f = 1 5 12 22 35 51 70 92 117 145 176 210 ...

8   Pass
x1 = 1500; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[1,0,0,1,0,1,0,0,1,0,1,0,0]))

g = [] j = 1 y = Columns 1 through 15 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 Columns 16 through 30 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 Columns 31 through 45 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 Columns 46 through 60 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 Columns 61 through 75 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 Columns 76 through 90 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 Columns 91 through 105 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 Columns 106 through 120 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 Columns 121 through 135 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 Columns 136 through 150 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 Columns 151 through 165 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 Columns 166 through 180 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 Columns 181 through 195 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 Columns 196 through 210 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 Columns 211 through 225 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 Columns 226 through 240 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 Columns 241 through 255 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 Columns 256 through 270 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 Columns 271 through 285 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 Columns 286 through 300 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 Columns 301 through 315 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 Columns 316 through 330 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 Columns 331 through 345 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 Columns 346 through 360 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 Columns 361 through 375 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 Columns 376 through 390 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 Columns 391 through 405 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 Columns 406 through 420 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 Columns 421 through 435 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 Columns 436 through 450 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 Columns 451 through 465 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 Columns 466 through 480 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 Columns 481 through 495 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 Columns 496 through 510 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 Columns 511 through 525 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 Columns 526 through 540 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 Columns 541 through 555 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 Columns 556 through 570 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 Columns 571 through 585 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 Columns 586 through 600 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 Columns 601 through 615 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 Columns 616 through 630 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 Columns 631 through 645 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 Columns 646 through 660 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 Columns 661 through 675 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 Columns 676 through 690 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 Columns 691 through 705 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 Columns 706 through 720 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 22...

9   Pass
x1 = 1; x2 = 3000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1,5,12,22,35,51,70,92,117,145,176,210,247,287,330,376,425,477,532,590,651,715,782,852,925,1001,1080,1162,1247,1335,1426,1520,1617,1717,1820,1926,2035,2147,2262,2380,2501,2625,2752,2882])) assert(isequal(d,[0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0]))

g = [] j = 1 y = Columns 1 through 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Columns 16 through 30 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 Columns 31 through 45 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 Columns 46 through 60 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 75 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 Columns 76 through 90 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 105 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 Columns 106 through 120 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 Columns 121 through 135 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 Columns 136 through 150 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 Columns 151 through 165 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 Columns 166 through 180 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 Columns 181 through 195 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 Columns 196 through 210 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 Columns 211 through 225 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 Columns 226 through 240 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 Columns 241 through 255 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 Columns 256 through 270 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 Columns 271 through 285 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 Columns 286 through 300 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 Columns 301 through 315 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 Columns 316 through 330 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 Columns 331 through 345 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 Columns 346 through 360 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 Columns 361 through 375 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 Columns 376 through 390 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 Columns 391 through 405 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 Columns 406 through 420 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 Columns 421 through 435 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 Columns 436 through 450 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 Columns 451 through 465 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 Columns 466 through 480 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 Columns 481 through 495 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 Columns 496 through 510 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 Columns 511 through 525 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 Columns 526 through 540 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 Columns 541 through 555 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 Columns 556 through 570 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 Columns 571 through 585 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 Columns 586 through 600 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 Columns 601 through 615 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 Columns 616 through 630 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 Columns 631 through 645 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 Columns 646 through 660 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 Columns 661 through 675 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 Columns 676 through 690 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 Columns 691 through 705 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 Columns 706 through 720 706 707 708 709 710 711 712 713 714 715 7...

10   Pass
x1 = 10000; x2 = 12000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[10045,10292,10542,10795,11051,11310,11572,11837])) assert(isequal(d,[1,0,0,1,0,1,0,0]))

g = [] j = 1 y = Columns 1 through 15 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 Columns 16 through 30 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 Columns 31 through 45 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 Columns 46 through 60 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 Columns 61 through 75 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 Columns 76 through 90 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 Columns 91 through 105 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 Columns 106 through 120 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 Columns 121 through 135 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 Columns 136 through 150 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 Columns 151 through 165 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 Columns 166 through 180 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 Columns 181 through 195 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 Columns 196 through 210 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 Columns 211 through 225 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 Columns 226 through 240 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 Columns 241 through 255 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 Columns 256 through 270 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 Columns 271 through 285 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 Columns 286 through 300 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 Columns 301 through 315 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 Columns 316 through 330 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 Columns 331 through 345 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 Columns 346 through 360 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 Columns 361 through 375 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 Columns 376 through 390 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 Columns 391 through 405 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 Columns 406 through 420 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 Columns 421 through 435 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 Columns 436 through 450 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 Columns 451 through 465 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 Columns 466 through 480 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 Columns 481 through 495 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 Columns 496 through 510 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 Columns 511 through 525 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 Columns 526 through 540 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 Columns 541 through 555 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 Columns 556 through 570 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 Columns 571 through 585 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 Columns 586 through 600 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 Columns 601 through 615 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 Columns 616 through 630 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 Columns 631 through 645 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 Columns 646 through 660 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 Columns 661 through 675 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 Columns 676 through 690 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 Columns 691 through 705 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 Columns 706 through 720 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 107...

11   Pass
x1 = 100000; x2 = 110000; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[100492,101270,102051,102835,103622,104412,105205,106001,106800,107602,108407,109215])) assert(isequal(d,[0,1,0,1,0,0,1,0,1,0,0,1]))

g = [] j = 1 y = Columns 1 through 15 100000 100001 100002 100003 100004 100005 100006 100007 100008 100009 100010 100011 100012 100013 100014 Columns 16 through 30 100015 100016 100017 100018 100019 100020 100021 100022 100023 100024 100025 100026 100027 100028 100029 Columns 31 through 45 100030 100031 100032 100033 100034 100035 100036 100037 100038 100039 100040 100041 100042 100043 100044 Columns 46 through 60 100045 100046 100047 100048 100049 100050 100051 100052 100053 100054 100055 100056 100057 100058 100059 Columns 61 through 75 100060 100061 100062 100063 100064 100065 100066 100067 100068 100069 100070 100071 100072 100073 100074 Columns 76 through 90 100075 100076 100077 100078 100079 100080 100081 100082 100083 100084 100085 100086 100087 100088 100089 Columns 91 through 105 100090 100091 100092 100093 100094 100095 100096 100097 100098 100099 100100 100101 100102 100103 100104 Columns 106 through 120 100105 100106 100107 100108 100109 100110 100111 100112 100113 100114 100115 100116 100117 100118 100119 Columns 121 through 135 100120 100121 100122 100123 100124 100125 100126 100127 100128 100129 100130 100131 100132 100133 100134 Columns 136 through 150 100135 100136 100137 100138 100139 100140 100141 100142 100143 100144 100145 100146 100147 100148 100149 Columns 151 through 165 100150 100151 100152 100153 100154 100155 100156 100157 100158 100159 100160 100161 100162 100163 100164 Columns 166 through 180 100165 100166 100167 100168 100169 100170 100171 100172 100173 100174 100175 100176 100177 100178 100179 Columns 181 through 195 100180 100181 100182 100183 100184 100185 100186 100187 100188 100189 100190 100191 100192 100193 100194 Columns 196 through 210 100195 100196 100197 100198 100199 100200 100201 100202 100203 100204 100205 100206 100207 100208 100209 Columns 211 through 225 100210 100211 100212 100213 100214 100215 100216 100217 100218 100219 100220 100221 100222 100223 100224 Columns 226 through 240 100225 100226 100227 100228 100229 100230 100231 100232 100233 100234 100235 100236 100237 100238 100239 Columns 241 through 255 100240 100241 100242 100243 100244 100245 100246 100247 100248 100249 100250 100251 100252 100253 100254 Columns 256 through 270 100255 100256 100257 100258 100259 100260 100261 100262 100263 100264 100265 100266 100267 100268 100269 Columns 271 through 285 100270 100271 100272 100273 100274 100275 100276 100277 100278 100279 100280 100281 100282 100283 100284 Columns 286 through 300 100285 100286 100287 100288 100289 100290 100291 100292 100293 100294 100295 100296 100297 100298 100299 Columns 301 through 315 100300 100301 100302 100303 100304 100305 100306 100307 100308 100309 100310 100311 100312 100313 100314 Columns 316 through 330 100315 100316 100317 100318 100319 100320 100321 100322 100323 100324 100325 100326 100327 100328 100329 Columns 331 through 345 100330 100331 100332 100333 100334 100335 100336 100337 100338 100339 100340 100341 100342 100343 100344 Columns 346 through 360 100345 100346 100347 100348 100349 100350 100351 100352 100353 100354 100355 100356 100357 100358 100359 Columns 361 through 375 100360 100361 100362 100363 100364 100365 100366 100367 100368 100369 100370 100371 100372 100373 100374 Columns 376 through 390 100375 100376 100377 100378 100379 100380 100381 100382 100383 100384 100385 100386 100387 100388 100389 Columns 391 through 405 100390 100391 100392 100393 100394 100395 100396 100397 100398 100399 100400 100401 100402 100403 100404 Columns 406 through 420 100405 100406 100407 100408 100409 100410 100411 100412 100413 100414 100415 100416 100417 100418 100419 Columns 421 through 435 100420 100421 100422 100423 100424 100425 100426 100427 100428 100429 100430 100431 100432 100433 100434 Columns 436 through 450 100435 100436 100437 100438 100439 100440 100441 100442 100443 100444 100445 100446 100447 100448 100449 Columns 451 through 465 100450 100451 100452 100453 100454 100455 100456 100457 100458 100459 100460 100461 100462 100463 100464 Columns 466 through 480 100465 100466 100467 100468 100469 100470 100471 100472 100473 100474 100475 100476 100477 100478 100479 Columns 481 through 495 100480 100481 100482 100483 100484 100485 100486 100487 100488 100489 100490 100491 100492 100493 100494 Columns 496 through 510 100495 100496 100497 100498 100499 100500 100501 100502 100503 100504 100505 100506 100507 100508 100509 Columns 511 through 525 100510 100511 100512 100513 100514 100515 100516 100517 100518 100519 100520 100521 100522 100523 100524 Columns 526 through 540 100525 100526 100527 100528 100529 100530 100531 100532 100533 100534 100535 100536 100537 100538 100539 Columns 541 through 555 100540 100541 100542 100543 100544 100545 100546 100547 100548 100549 100550 100551 100552 100553 100554 Columns 556 through 570 100555 100556 100557 100558 100559 100560 100561 100562 100563 100564 100565 100566 100567 100568 100569 Columns 571 through 585 100570 100571 100572 100573 100574 100575 100576 100577 100578 100579 100580 100581 100582 100583 100584 Columns 586 through 600 100585 100586 100587 100588 100589 100590 100591 100592 100593 100594 100595 100596 100597 100598 100599 Columns 601 through 615 100600 100601 100602 100603 100604 100605 100606 100607 100608 100609 100610 100611 100612 100613 100614 Columns 616 through 630 100615 100616 100617 100618 100619 100620 100621 100622 100623 100624 100625 100626 100627 100628 100629 Columns 631 through 645 100630 100631 100632 100633 100634 100635 100636 100637 100638 100639 100640 100641 100642 100643 100644 Columns 646 through 660 100645 100646 100647 100648 100649 100650 100651 100652 100653 100654 100655 100656 100657 100658 100659 Columns 661 through 675 100660 100661 100662 100663 100664 100665 100666 100667 100668 100669 100670 100671 100672 100673 100674 Columns 676 through 690 100675 100676 100677 100678 100679 100680 100681 100682 100683 100684 100685 100686 100687 100688 100689 Columns 691 through 705 100690 100691 100692 100693 100694 100695 100696 100697 100698 100699 100700 100701 100702 100703 100704 Columns 706 through 720 100705 100706 100707 100708 100709 100710 100711 100712 100713 100714 1007...

12   Pass
x1 = 1000000; x2 = 1010101; [p,d] = pentagonal_numbers(x1,x2) assert(isequal(p,[1000825,1003277,1005732,1008190])) assert(isequal(d,[1,0,0,1]))

g = [] j = 1 y = Columns 1 through 15 1000000 1000001 1000002 1000003 1000004 1000005 1000006 1000007 1000008 1000009 1000010 1000011 1000012 1000013 1000014 Columns 16 through 30 1000015 1000016 1000017 1000018 1000019 1000020 1000021 1000022 1000023 1000024 1000025 1000026 1000027 1000028 1000029 Columns 31 through 45 1000030 1000031 1000032 1000033 1000034 1000035 1000036 1000037 1000038 1000039 1000040 1000041 1000042 1000043 1000044 Columns 46 through 60 1000045 1000046 1000047 1000048 1000049 1000050 1000051 1000052 1000053 1000054 1000055 1000056 1000057 1000058 1000059 Columns 61 through 75 1000060 1000061 1000062 1000063 1000064 1000065 1000066 1000067 1000068 1000069 1000070 1000071 1000072 1000073 1000074 Columns 76 through 90 1000075 1000076 1000077 1000078 1000079 1000080 1000081 1000082 1000083 1000084 1000085 1000086 1000087 1000088 1000089 Columns 91 through 105 1000090 1000091 1000092 1000093 1000094 1000095 1000096 1000097 1000098 1000099 1000100 1000101 1000102 1000103 1000104 Columns 106 through 120 1000105 1000106 1000107 1000108 1000109 1000110 1000111 1000112 1000113 1000114 1000115 1000116 1000117 1000118 1000119 Columns 121 through 135 1000120 1000121 1000122 1000123 1000124 1000125 1000126 1000127 1000128 1000129 1000130 1000131 1000132 1000133 1000134 Columns 136 through 150 1000135 1000136 1000137 1000138 1000139 1000140 1000141 1000142 1000143 1000144 1000145 1000146 1000147 1000148 1000149 Columns 151 through 165 1000150 1000151 1000152 1000153 1000154 1000155 1000156 1000157 1000158 1000159 1000160 1000161 1000162 1000163 1000164 Columns 166 through 180 1000165 1000166 1000167 1000168 1000169 1000170 1000171 1000172 1000173 1000174 1000175 1000176 1000177 1000178 1000179 Columns 181 through 195 1000180 1000181 1000182 1000183 1000184 1000185 1000186 1000187 1000188 1000189 1000190 1000191 1000192 1000193 1000194 Columns 196 through 210 1000195 1000196 1000197 1000198 1000199 1000200 1000201 1000202 1000203 1000204 1000205 1000206 1000207 1000208 1000209 Columns 211 through 225 1000210 1000211 1000212 1000213 1000214 1000215 1000216 1000217 1000218 1000219 1000220 1000221 1000222 1000223 1000224 Columns 226 through 240 1000225 1000226 1000227 1000228 1000229 1000230 1000231 1000232 1000233 1000234 1000235 1000236 1000237 1000238 1000239 Columns 241 through 255 1000240 1000241 1000242 1000243 1000244 1000245 1000246 1000247 1000248 1000249 1000250 1000251 1000252 1000253 1000254 Columns 256 through 270 1000255 1000256 1000257 1000258 1000259 1000260 1000261 1000262 1000263 1000264 1000265 1000266 1000267 1000268 1000269 Columns 271 through 285 1000270 1000271 1000272 1000273 1000274 1000275 1000276 1000277 1000278 1000279 1000280 1000281 1000282 1000283 1000284 Columns 286 through 300 1000285 1000286 1000287 1000288 1000289 1000290 1000291 1000292 1000293 1000294 1000295 1000296 1000297 1000298 1000299 Columns 301 through 315 1000300 1000301 1000302 1000303 1000304 1000305 1000306 1000307 1000308 1000309 1000310 1000311 1000312 1000313 1000314 Columns 316 through 330 1000315 1000316 1000317 1000318 1000319 1000320 1000321 1000322 1000323 1000324 1000325 1000326 1000327 1000328 1000329 Columns 331 through 345 1000330 1000331 1000332 1000333 1000334 1000335 1000336 1000337 1000338 1000339 1000340 1000341 1000342 1000343 1000344 Columns 346 through 360 1000345 1000346 1000347 1000348 1000349 1000350 1000351 1000352 1000353 1000354 1000355 1000356 1000357 1000358 1000359 Columns 361 through 375 1000360 1000361 1000362 1000363 1000364 1000365 1000366 1000367 1000368 1000369 1000370 1000371 1000372 1000373 1000374 Columns 376 through 390 1000375 1000376 1000377 1000378 1000379 1000380 1000381 1000382 1000383 1000384 1000385 1000386 1000387 1000388 1000389 Columns 391 through 405 1000390 1000391 1000392 1000393 1000394 1000395 1000396 1000397 1000398 1000399 1000400 1000401 1000402 1000403 1000404 Columns 406 through 420 1000405 1000406 1000407 1000408 1000409 1000410 1000411 1000412 1000413 1000414 1000415 1000416 1000417 1000418 1000419 Columns 421 through 435 1000420 1000421 1000422 1000423 1000424 1000425 1000426 1000427 1000428 1000429 1000430 1000431 1000432 1000433 1000434 Columns 436 through 450 1000435 1000436 1000437 1000438 1000439 1000440 1000441 1000442 1000443 1000444 1000445 1000446 1000447 1000448 1000449 Columns 451 through 465 1000450 1000451 1000452 1000453 1000454 1000455 1000456 1000457 1000458 1000459 1000460 1000461 1000462 1000463 1000464 Columns 466 through 480 1000465 1000466 1000467 1000468 1000469 1000470 1000471 1000472 1000473 1000474 1000475 1000476 1000477 1000478 1000479 Columns 481 through 495 1000480 1000481 1000482 1000483 1000484 1000485 1000486 1000487 1000488 1000489 1000490 1000491 1000492 1000493 1000494 Columns 496 through 510 1000495 1000496 1000497 1000498 1000499 1000500 1000501 1000502 1000503 1000504 1000505 1000506 1000507 1000508 1000509 Columns 511 through 525 1000510 1000511 1000512 1000513 1000514 1000515 1000516 1000517 1000518 1000519 1000520 1000521 1000522 1000523 1000524 Columns 526 through 540 1000525 1000526 1000527 1000528 1000529 1000530 1000531 1000532 1000533 1000534 1000535 1000536 1000537 1000538 1000539 Columns 541 through 555 1000540 1000541 1000542 1000543 1000544 1000545 1000546 1000547 1000548 1000549 1000550 1000551 1000552 1000553 1000554 Columns 556 through 570 1000555 1000556 1000557 1000558 1000559 1000560 1000561 1000562 1000563 1000564 1000565 1000566 1000567 1000568 1000569 Columns 571 through 585 1000570 1000571 1000572 1000573 1000574 1000575 1000576 1000577 1000578 1000579 1000580 1000581 1000582 1000583 1000584 Columns 586 through 600 1000585 1000586 1000587 1000588 1000589 1000590 1000591 1000592 1000593 1000594 1000595 1000596 1000597 1000598 1000599 Columns 601 through 615 1000600 1000601 1000602 1000603 1000604 1000605 1000606 1000607 1000608 1000609 1000610 1000611 1000612 1000613 1000614 Columns 616 through 630 1000615 1000616 1000617 1000618 1000619 1000620 1000621 1000622 1000623 1000624 1000625 1000626 1000627 1000628 1000629 Columns 631 through 645 1000630 1000631 1000632 1000633 1000634 1000635 1000636 1000637 1000638 1000639 1000640 1000641 1000642 1000643 1000644 Columns 646 through 660 1000645 1000646 1000647 1000648 1000649 1000650 1000651 1000652 1000653 1000654 1000655 1000656 1000657 1000658 1000659 Columns 661 through 675 1000660 1000661 1000662 1000663 1000664 1000665 1000666 1000667 1000668 1000669 1000670 1000671 1000672 1000673 1000674 Columns 676 through 690 1000675 1000676 1000677 1000678 1000679 1000680 1000681 1000682 1000683 1000684 1000685 1000686 1000687 1000688 1000689 Columns 691 through 705 1000690 1000691 1000692 1000693 1000694 1000695 1000696 1000697 1000698 1000699 1000700 1000701 1000702 1000703 1000704 Columns 706 through 720 1000705 1000706 1000707 1000708 1000709 1000710 1000711 1000712 1000713 1000714 10007...

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!