Cody

# Problem 42673. Longest Collatz Sequence

Solution 3086816

Submitted on 6 Oct 2020 by Jens Kjærgaard Boldsen
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 = 10; assert(isequal(euler14(x),9))

ans = 6 ans = 10 mx = 19 y = 9

2   Pass
x = 100; assert(isequal(euler14(x),97))

ans = 25 ans = 100 mx = 118 y = 97

3   Pass
x = 96; assert(isequal(euler14(x),73))

ans = 12 ans = 96 mx = 115 y = 73

4   Pass
x = 1000; assert(isequal(euler14(x),871))

ans = 111 ans = 1000 mx = 178 y = 871

5   Pass
x = 870; assert(isequal(euler14(x),703))

ans = 28 ans = 870 mx = 170 y = 703

6   Pass
assert(isequal(euler14(871),871))

ans = 178 ans = 871 mx = 178 y = 871

7   Pass
x = 77030; assert(isequal(euler14(x),52527))

ans = 107 ans = 77030 mx = 339 y = 52527

8   Pass
x = 77031; assert(isequal(euler14(x),77031))

ans = 350 ans = 77031 mx = 350 y = 77031

9   Pass
assert(isequal(euler14(500000),410011))

ans = 151 ans = 500000 mx = 448 y = 410011

10   Pass
z = 900000; y_correct=837799; assert(isequal(euler14(z),y_correct))

ans = 157 ans = 900000 mx = 524 y = 837799

### Community Treasure Hunt

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

Start Hunting!