Cody

Problem 44338. Recaman Sequence - I

Solution 1937462

Submitted on 15 Sep 2019
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
x = 1; y_correct = 0; assert(isequal(Recaman(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

2   Pass
x = 5; y_correct = [0 1 3 6 2]; assert(isequal(Recaman(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

3   Pass
x = 8; y_correct = [0 1 3 6 2 7 13 20]; assert(isequal(Recaman(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

4   Pass
x = 10; y_correct = [0 1 3 6 2 7 13 20 12 21]; assert(isequal(Recaman(x),y_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

5   Fail
x = 5e4; y = Recaman(x); assert(isequal(length(Recaman(x)),x)) assert(isequal(y(954),739)) assert(isequal(y(7589),17654)) assert(isequal(y(12345),18554))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

Index exceeds the number of array elements (1). Error in Test5 (line 4) assert(isequal(y(954),739))

6   Fail
x = 1e5; y = Recaman(x); assert(isequal(length(Recaman(x)),x)) assert(isequal(y(1e4),8658)) assert(isequal(y(2e4),34358)) assert(isequal(y(3e4),92474)) assert(isequal(y(4e4),102344))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In Recaman (line 2) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

Index exceeds the number of array elements (1). Error in Test6 (line 4) assert(isequal(y(1e4),8658))