Cody

Problem 888. Create a vector whose elements depend on the previous element

Solution 1593405

Submitted on 27 Jul 2018
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   Fail
A = 1; iterations = 4; y_correct = [1 3 7 15 31]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 1 append = 3 y = 1 3 append = 7 y = 1 3 7 append = 15 y = 1 3 7 15

Assertion failed.

2   Fail
A = 1; iterations = 10; y_correct = [1 3 7 15 31 63 127 255 511 1023 2047]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 1 append = 3 y = 1 3 append = 7 y = 1 3 7 append = 15 y = 1 3 7 15 append = 31 y = 1 3 7 15 31 append = 63 y = 1 3 7 15 31 63 append = 127 y = 1 3 7 15 31 63 127 append = 255 y = 1 3 7 15 31 63 127 255 append = 511 y = 1 3 7 15 31 63 127 255 511 append = 1023 y = 1 3 7 15 31 63 127 255 511 1023

Assertion failed.

3   Fail
A = 2; iterations = 10; y_correct = [2 5 11 23 47 95 191 383 767 1535 3071]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 2 append = 5 y = 2 5 append = 11 y = 2 5 11 append = 23 y = 2 5 11 23 append = 47 y = 2 5 11 23 47 append = 95 y = 2 5 11 23 47 95 append = 191 y = 2 5 11 23 47 95 191 append = 383 y = 2 5 11 23 47 95 191 383 append = 767 y = 2 5 11 23 47 95 191 383 767 append = 1535 y = 2 5 11 23 47 95 191 383 767 1535

Assertion failed.

4   Fail
A = 3; iterations = 10; y_correct = [3 7 15 31 63 127 255 511 1023 2047 4095]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 3 append = 7 y = 3 7 append = 15 y = 3 7 15 append = 31 y = 3 7 15 31 append = 63 y = 3 7 15 31 63 append = 127 y = 3 7 15 31 63 127 append = 255 y = 3 7 15 31 63 127 255 append = 511 y = 3 7 15 31 63 127 255 511 append = 1023 y = 3 7 15 31 63 127 255 511 1023 append = 2047 y = 3 7 15 31 63 127 255 511 1023 2047

Assertion failed.

5   Fail
A = 5; iterations = 10; y_correct = [5 11 23 47 95 191 383 767 1535 3071 6143]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 5 append = 11 y = 5 11 append = 23 y = 5 11 23 append = 47 y = 5 11 23 47 append = 95 y = 5 11 23 47 95 append = 191 y = 5 11 23 47 95 191 append = 383 y = 5 11 23 47 95 191 383 append = 767 y = 5 11 23 47 95 191 383 767 append = 1535 y = 5 11 23 47 95 191 383 767 1535 append = 3071 y = 5 11 23 47 95 191 383 767 1535 3071

Assertion failed.

6   Fail
A = 7; iterations = 8; y_correct = [7 15 31 63 127 255 511 1023 2047]; assert(isequal(your_fcn_name(A,iterations),y_correct))

y = 7 append = 15 y = 7 15 append = 31 y = 7 15 31 append = 63 y = 7 15 31 63 append = 127 y = 7 15 31 63 127 append = 255 y = 7 15 31 63 127 255 append = 511 y = 7 15 31 63 127 255 511 append = 1023 y = 7 15 31 63 127 255 511 1023

Assertion failed.