Cody

# Problem 5. Triangle Numbers

Solution 1906488

Submitted on 20 Aug 2019 by Zhichen Zhu
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 = 1; t = 1; assert(isequal(triangle(n),t))

x = 1 t = 1

2   Pass
n = 3; t = 6; assert(isequal(triangle(n),t))

x = 1 t = 1 x = 1 3 t = 3 x = 1 3 6 t = 6

3   Pass
n = 5; t = 15; assert(isequal(triangle(n),t))

x = 1 t = 1 x = 1 3 t = 3 x = 1 3 6 t = 6 x = 1 3 6 10 t = 10 x = 1 3 6 10 15 t = 15

4   Pass
n = 30; t = 465; assert(isequal(triangle(n),t))

x = 1 t = 1 x = 1 3 t = 3 x = 1 3 6 t = 6 x = 1 3 6 10 t = 10 x = 1 3 6 10 15 t = 15 x = 1 3 6 10 15 21 t = 21 x = 1 3 6 10 15 21 28 t = 28 x = 1 3 6 10 15 21 28 36 t = 36 x = 1 3 6 10 15 21 28 36 45 t = 45 x = 1 3 6 10 15 21 28 36 45 55 t = 55 x = 1 3 6 10 15 21 28 36 45 55 66 t = 66 x = 1 3 6 10 15 21 28 36 45 55 66 78 t = 78 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 t = 91 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 t = 105 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 t = 120 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 t = 136 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 t = 153 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 t = 171 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 t = 190 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 t = 210 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 t = 231 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 t = 253 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 t = 276 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 t = 300 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 t = 325 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 t = 351 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 t = 378 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 t = 406 x = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 t = 435 x = Columns 1 through 29 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 Column 30 465 t = 465