Cody

Problem 1190. Golomb's self-describing sequence (based on Euler 341)

Solution 2059625

Submitted on 16 Dec 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   Fail
assert(isequal(euler341(1),1))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test1 (line 1) assert(isequal(euler341(1),1))

2   Fail
assert(isequal(euler341(10),5))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test2 (line 1) assert(isequal(euler341(10),5))

3   Fail
assert(isequal(euler341(310),42))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test3 (line 1) assert(isequal(euler341(310),42))

4   Fail
assert(isequal(euler341(4242),210))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test4 (line 1) assert(isequal(euler341(4242),210))

5   Fail
assert(isequal(euler341(328509),3084))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test5 (line 1) assert(isequal(euler341(328509),3084))

6   Fail
assert(isequal(euler341(551368),4247))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test6 (line 1) assert(isequal(euler341(551368),4247))

7   Fail
assert(isequal(euler341(614125),4540))

Array indices must be positive integers or logical values. Error in euler341 (line 4) z(i + 1) = 1 + z(i - z(z(i - 1))); Error in Test7 (line 1) assert(isequal(euler341(614125),4540))