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 261393

Submitted on 14 Jun 2013 by andrea84

Correct

37Size
Leading solution size is 15.
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
 
%%
n = 2;
A_correct = 2;
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
ans =
     2
2
Pass
 
%%
n = 3;
A_correct = [2 3];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
ans =
     2     3
3
Pass
 
%%
n = 4;
A_correct = [2 3 4];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
c =
     0     1     1     1
ans =
     2     3     4
4
Pass
 
%%
n = 5;
A_correct = [2 3 4 5];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
c =
     0     1     1     1
c =
     0     1     1     1     1
ans =
     2     3     4     5
5
Pass
 
%%
n = 10;
A_correct = [2 3 4 5 6 8 9 10];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
c =
     0     1     1     1
c =
     0     1     1     1     1
c =
     0     1     1     1     1     1
c =
     0     1     1     1     1     1     0
c =
     0     1     1     1     1     1     0     1
c =
     0     1     1     1     1     1     0     1     1
c =
     0     1     1     1     1     1     0     1     1     1
ans =
     2     3     4     5     6     8     9    10
6
Pass
 
%%
n = 17;
A_correct = [2 3 4 5 6 8 9 10 12 15 16];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
c =
     0     1     1     1
c =
     0     1     1     1     1
c =
     0     1     1     1     1     1
c =
     0     1     1     1     1     1     0
c =
     0     1     1     1     1     1     0     1
c =
     0     1     1     1     1     1     0     1     1
c =
     0     1     1     1     1     1     0     1     1     1
c =
     0     1     1     1     1     1     0     1     1     1     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Column 17
     0
ans =
     2     3     4     5     6     8     9    10    12    15    16
7
Pass
 
%%
n = 31;
A_correct = [2 3 4 5 6 8 9 10 12 15 16 18 20 24 25 27 30];
assert(isequal(your_fcn_name(n),A_correct))
c =
     0
c =
     0     1
c =
     0     1     1
c =
     0     1     1     1
c =
     0     1     1     1     1
c =
     0     1     1     1     1     1
c =
     0     1     1     1     1     1     0
c =
     0     1     1     1     1     1     0     1
c =
     0     1     1     1     1     1     0     1     1
c =
     0     1     1     1     1     1     0     1     1     1
c =
     0     1     1     1     1     1     0     1     1     1     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1
c =
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Column 17
     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 18
     0     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 19
     0     1     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 20
     0     1     0     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 21
     0     1     0     1     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 22
     0     1     0     1     0     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 23
     0     1     0     1     0     0     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 24
     0     1     0     1     0     0     0     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 25
     0     1     0     1     0     0     0     1     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 26
     0     1     0     1     0     0     0     1     1     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 27
     0     1     0     1     0     0     0     1     1     0     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 28
     0     1     0     1     0     0     0     1     1     0     1     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 29
     0     1     0     1     0     0     0     1     1     0     1     0     0
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 30
     0     1     0     1     0     0     0     1     1     0     1     0     0     1
c =
  Columns 1 through 16
     0     1     1     1     1     1     0     1     1     1     0     1     0     0     1     1
  Columns 17 through 31
     0     1     0     1     0     0     0     1     1     0     1     0     0     1     0
ans =
  Columns 1 through 16
     2     3     4     5     6     8     9    10    12    15    16    18    20    24    25    27
  Column 17
    30