Cody

# Problem 291. Triangle Numbers Below N

Solution 90599

Submitted on 21 May 2012 by Mark
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 = 100; y_correct = cumsum(1:13); assert(isequal(TriBeNum(x),y_correct))

``` y = 1 y = 1 3 y = 1 3 6 y = 1 3 6 10 y = 1 3 6 10 15 y = 1 3 6 10 15 21 y = 1 3 6 10 15 21 28 y = 1 3 6 10 15 21 28 36 y = 1 3 6 10 15 21 28 36 45 y = 1 3 6 10 15 21 28 36 45 55 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Column 11 66 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 12 66 78 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 13 66 78 91 ```

2   Pass
%% x = 1000; y_correct = cumsum(1:44); assert(isequal(TriBeNum(x),y_correct))

``` y = 1 y = 1 3 y = 1 3 6 y = 1 3 6 10 y = 1 3 6 10 15 y = 1 3 6 10 15 21 y = 1 3 6 10 15 21 28 y = 1 3 6 10 15 21 28 36 y = 1 3 6 10 15 21 28 36 45 y = 1 3 6 10 15 21 28 36 45 55 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Column 11 66 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 12 66 78 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 13 66 78 91 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 14 66 78 91 105 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 15 66 78 91 105 120 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 16 66 78 91 105 120 136 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 17 66 78 91 105 120 136 153 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 18 66 78 91 105 120 136 153 171 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 19 66 78 91 105 120 136 153 171 190 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Column 21 231 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 22 231 253 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 23 231 253 276 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 24 231 253 276 300 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 25 231 253 276 300 325 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 26 231 253 276 300 325 351 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 27 231 253 276 300 325 351 378 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 28 231 253 276 300 325 351 378 406 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 29 231 253 276 300 325 351 378 406 435 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Column 31 496 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 32 496 528 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 33 496 528 561 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 34 496 528 561 595 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 35 496 528 561 595 630 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 36 496 528 561 595 630 666 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 37 496 528 561 595 630 666 703 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 38 496 528 561 595 630 666 703 741 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 39 496 528 561 595 630 666 703 741 780 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 40 496 528 561 595 630 666 703 741 780 820 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 40 496 528 561 595 630 666 703 741 780 820 Column 41 861 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 40 496 528 561 595 630 666 703 741 780 820 Columns 41 through 42 861 903 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 40 496 528 561 595 630 666 703 741 780 820 Columns 41 through 43 861 903 946 y = Columns 1 through 10 1 3 6 10 15 21 28 36 45 55 Columns 11 through 20 66 78 91 105 120 136 153 171 190 210 Columns 21 through 30 231 253 276 300 325 351 378 406 435 465 Columns 31 through 40 496 528 561 595 630 666 703 741 780 820 Columns 41 through 44 861 903 946 990 ```