Cody

Solution 8106

Submitted on 27 Jan 2012 by Jonathan
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
%% n = 1; c_correct = 1; assert(isequal(collatz(n),c_correct))

2   Pass
%% n = 2; c_correct = [2 1]; assert(isequal(collatz(n),c_correct))

c = 2 1

3   Pass
%% n = 5; c_correct = [5 16 8 4 2 1]; assert(isequal(collatz(n),c_correct))

c = 5.0000 2.5000 c = 5 16 8 c = 5 16 8 4 c = 5 16 8 4 2 c = 5 16 8 4 2 1

4   Pass
%% n = 22; c_correct = [22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1]; assert(isequal(collatz(n),c_correct))

c = 22 11 c = 22.0000 11.0000 5.5000 c = 22 11 34 17 c = 22.0000 11.0000 34.0000 17.0000 8.5000 c = 22 11 34 17 52 26 c = 22 11 34 17 52 26 13 c = Columns 1 through 6 22.0000 11.0000 34.0000 17.0000 52.0000 26.0000 Columns 7 through 8 13.0000 6.5000 c = 22 11 34 17 52 26 13 40 20 c = 22 11 34 17 52 26 13 40 20 10 c = Columns 1 through 10 22 11 34 17 52 26 13 40 20 10 Column 11 5 c = Columns 1 through 6 22.0000 11.0000 34.0000 17.0000 52.0000 26.0000 Columns 7 through 12 13.0000 40.0000 20.0000 10.0000 5.0000 2.5000 c = Columns 1 through 10 22 11 34 17 52 26 13 40 20 10 Columns 11 through 13 5 16 8 c = Columns 1 through 10 22 11 34 17 52 26 13 40 20 10 Columns 11 through 14 5 16 8 4 c = Columns 1 through 10 22 11 34 17 52 26 13 40 20 10 Columns 11 through 15 5 16 8 4 2 c = Columns 1 through 10 22 11 34 17 52 26 13 40 20 10 Columns 11 through 16 5 16 8 4 2 1

Suggested Problems