Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 291128

Submitted on 28 Jul 2013 by Ali Nazari

Correct

40Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x = 100;
y_correct = cumsum(1:13);
assert(isequal(TriBeNum(x),y_correct))
[Warning: FOR loop index is too large. Truncating to 9223372036854775807.]
[> In TriBeNum at 3
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
y =
     1     3     6    10    15    21    28    36    45    55    66    78    91
2
Pass
 
%%
x = 1000;
y_correct = cumsum(1:44);
assert(isequal(TriBeNum(x),y_correct))
[Warning: FOR loop index is too large. Truncating to 9223372036854775807.]
[> In TriBeNum at 3
  In verifyCode>evaluateCode at 227
  In verifyCode at 40
  In fevalJSON at 14]
y =
  Columns 1 through 16
     1     3     6    10    15    21    28    36    45    55    66    78    91   105   120   136
  Columns 17 through 32
   153   171   190   210   231   253   276   300   325   351   378   406   435   465   496   528
  Columns 33 through 44
   561   595   630   666   703   741   780   820   861   903   946   990