Cody

# Problem 2423. Integer Sequence - II : New Fibonacci

Solution 1910012

Submitted on 23 Aug 2019 by Eugene Avrutin
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
assert(isequal(newFibo(1),1))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next1 = 1 second1 = 1 first1 = 1 y = 1

2   Pass
assert(isequal(newFibo(2),1))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next1 = 1 second1 = 1 first1 = 1 y = 1

3   Pass
assert(isequal(newFibo(3),1))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 y = 1

4   Pass
assert(isequal(newFibo(4),2))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 next1 = 3 second1 = 2 first1 = 3 y = 2

5   Pass
assert(isequal(newFibo(5),5))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 next1 = 3 second1 = 2 first1 = 3 next1 = 5 second1 = 3 first1 = 5 next1 = 8 second1 = 5 first1 = 8 y = 5

6   Pass
assert(isequal(newFibo(6),21))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next = 13 second = 8 first = 13 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 next1 = 3 second1 = 2 first1 = 3 next1 = 5 second1 = 3 first1 = 5 next1 = 8 second1 = 5 first1 = 8 next1 = 13 second1 = 8 first1 = 13 next1 = 21 second1 = 13 first1 = 21 next1 = 34 second1 = 21 first1 = 34 y = 21

7   Pass
assert(isequal(newFibo(8),10946))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next = 13 second = 8 first = 13 next = 21 second = 13 first = 21 next = 34 second = 21 first = 34 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 next1 = 3 second1 = 2 first1 = 3 next1 = 5 second1 = 3 first1 = 5 next1 = 8 second1 = 5 first1 = 8 next1 = 13 second1 = 8 first1 = 13 next1 = 21 second1 = 13 first1 = 21 next1 = 34 second1 = 21 first1 = 34 next1 = 55 second1 = 34 first1 = 55 next1 = 89 second1 = 55 first1 = 89 next1 = 144 second1 = 89 first1 = 144 next1 = 233 second1 = 144 first1 = 233 next1 = 377 second1 = 233 first1 = 377 next1 = 610 second1 = 377 first1 = 610 next1 = 987 second1 = 610 first1 = 987 next1 = 1597 second1 = 987 first1 = 1597 next1 = 2584 second1 = 1597 first1 = 2584 next1 = 4181 second1 = 2584 first1 = 4181 next1 = 6765 second1 = 4181 first1 = 6765 next1 = 10946 second1 = 6765 first1 = 10946 next1 = 17711 second1 = 10946 first1 = 17711 y = 10946

8   Pass
assert(isequal(newFibo(9),5702887))

first = 1 second = 0 first1 = 1 second1 = 0 next = 1 second = 1 first = 1 next = 2 second = 1 first = 2 next = 3 second = 2 first = 3 next = 5 second = 3 first = 5 next = 8 second = 5 first = 8 next = 13 second = 8 first = 13 next = 21 second = 13 first = 21 next = 34 second = 21 first = 34 next = 55 second = 34 first = 55 next1 = 1 second1 = 1 first1 = 1 next1 = 2 second1 = 1 first1 = 2 next1 = 3 second1 = 2 first1 = 3 next1 = 5 second1 = 3 first1 = 5 next1 = 8 second1 = 5 first1 = 8 next1 = 13 second1 = 8 first1 = 13 next1 = 21 second1 = 13 first1 = 21 next1 = 34 second1 = 21 first1 = 34 next1 = 55 second1 = 34 first1 = 55 next1 = 89 second1 = 55 first1 = 89 next1 = 144 second1 = 89 first1 = 144 next1 = 233 second1 = 144 first1 = 233 next1 = 377 second1 = 233 first1 = 377 next1 = 610 second1 = 377 first1 = 610 next1 = 987 second1 = 610 first1 = 987 next1 = 1597 second1 = 987 first1 = 1597 next1 = 2584 second1 = 1597 first1 = 2584 next1 = 4181 second1 = 2584 first1 = 4181 next1 = 6765 second1 = 4181 first1 = 6765 next1 = 10946 second1 = 6765 first1 = 10946 next1 = 17711 second1 = 10946 first1 = 17711 next1 = 28657 second1 = 17711 first1 = 28657 next1 = 46368 second1 = 28657 first1 = 46368 next1 = 75025 second1 = 46368 first1 = 75025 next1 = 121393 second1 = 75025 first1 = 121393 next1 = 196418 second1 = 121393 first1 = 196418 next1 = 317811 second1 = 196418 first1 = 317811 next1 = 514229 second1 = 317811 first1 = 514229 next1 = 832040 second1 = 514229 first1 = 832040 next1 = 1346269 second1 = 832040 first1 = 1346269 next1 = 2178309 second1 = 1346269 first1 = 2178309 next1 = 3524578 second1 = 2178309 first1 = 3524578 next1 = 5702887 second1 = 3524578 first1 = 5702887 next1 = 9227465 second1 = 5702887 first1 = 9227465 y = 5702887