Cody

Problem 42841. Return the sequence element III

Solution 3008269

Submitted on 30 Sep 2020 by Rafael S.T. Vieira
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
x1 = 1; x2 = 2; n = 5; y_correct = 6; assert(isequal(ulam(x1,x2,n),y_correct))

2   Pass
x1 = 1; x2 = 2; n = 22; y_correct = 77; assert(isequal(ulam(x1,x2,n),y_correct))

3   Pass
x1 = 1; x2 = 3; n = 49; y_correct = 212; assert(isequal(ulam(x1,x2,n),y_correct))

4   Pass
x1 = 1; x2 = 5; n = 10; y_correct = 22; assert(isequal(ulam(x1,x2,n),y_correct))

5   Pass
x1 = 2; x2 = 9; n = 8; y_correct = 20; assert(isequal(ulam(x1,x2,n),y_correct))

6   Pass
x1 = 2; x2 = 9; n = 26; y_correct = 77; assert(isequal(ulam(x1,x2,n),y_correct))

7   Pass
x1 = 4; x2 = 5; n = 29; y_correct = 123; assert(isequal(ulam(x1,x2,n),y_correct))

8   Pass
x1 = 6; x2 = 7; n = 29; y_correct = 123; assert(isequal(ulam(x1,x2,n),y_correct))

Suggested Problems

More from this Author34

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!