Cody

Solution 1809265

Submitted on 7 May 2019 by Aseem Gill
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 =4000000 y_correct = 4613732; assert(isequal(euler002(x),y_correct))

x = 4000000 fib = 1 2 new = 3 fib = 1 2 3 new = 5 fib = 1 2 3 5 new = 8 fib = 1 2 3 5 8 new = 13 fib = 1 2 3 5 8 13 new = 21 fib = 1 2 3 5 8 13 21 new = 34 fib = 1 2 3 5 8 13 21 34 new = 55 fib = 1 2 3 5 8 13 21 34 55 new = 89 fib = 1 2 3 5 8 13 21 34 55 89 new = 144 fib = 1 2 3 5 8 13 21 34 55 89 144 new = 233 fib = 1 2 3 5 8 13 21 34 55 89 144 233 new = 377 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 new = 610 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 new = 987 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 new = 1597 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Column 16 1597 new = 2584 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 17 1597 2584 new = 4181 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 18 1597 2584 4181 new = 6765 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 19 1597 2584 4181 6765 new = 10946 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 20 1597 2584 4181 6765 10946 new = 17711 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 21 1597 2584 4181 6765 10946 17711 new = 28657 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 22 1597 2584 4181 6765 10946 17711 28657 new = 46368 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 23 1597 2584 4181 6765 10946 17711 28657 46368 new = 75025 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 24 1597 2584 4181 6765 10946 17711 28657 46368 75025 new = 121393 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 25 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 new = 196418 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 26 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 new = 317811 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 27 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 new = 514229 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 28 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 new = 832040 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 29 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 new = 1346269 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 new = 2178309 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Column 31 2178309 new = 3524578 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 32 2178309 3524578 new = 5702887 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 33 2178309 3524578 5702887 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 32 2178309 3524578 evens = [] evens = 2 evens = 2 8 evens = 2 8 34 evens = 2 8 34 144 evens = 2 8 34 144 610 evens = 2 8 34 144 610 2584 evens = 2 8 34 144 610 2584 10946 evens = 2 8 34 144 610 2584 10946 46368 evens = 2 8 34 144 610 2584 10946 46368 196418 evens = 2 8 34 144 610 2584 10946 46368 196418 832040 evens = 2 8 34 144 610 2584 10946 46368 196418 832040 3524578 y = 4613732

2   Pass
x =97455000 y_correct = 82790070; assert(isequal(euler002(x),y_correct))

x = 97455000 fib = 1 2 new = 3 fib = 1 2 3 new = 5 fib = 1 2 3 5 new = 8 fib = 1 2 3 5 8 new = 13 fib = 1 2 3 5 8 13 new = 21 fib = 1 2 3 5 8 13 21 new = 34 fib = 1 2 3 5 8 13 21 34 new = 55 fib = 1 2 3 5 8 13 21 34 55 new = 89 fib = 1 2 3 5 8 13 21 34 55 89 new = 144 fib = 1 2 3 5 8 13 21 34 55 89 144 new = 233 fib = 1 2 3 5 8 13 21 34 55 89 144 233 new = 377 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 new = 610 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 new = 987 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 new = 1597 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Column 16 1597 new = 2584 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 17 1597 2584 new = 4181 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 18 1597 2584 4181 new = 6765 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 19 1597 2584 4181 6765 new = 10946 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 20 1597 2584 4181 6765 10946 new = 17711 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 21 1597 2584 4181 6765 10946 17711 new = 28657 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 22 1597 2584 4181 6765 10946 17711 28657 new = 46368 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 23 1597 2584 4181 6765 10946 17711 28657 46368 new = 75025 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 24 1597 2584 4181 6765 10946 17711 28657 46368 75025 new = 121393 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 25 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 new = 196418 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 26 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 new = 317811 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 27 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 new = 514229 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 28 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 new = 832040 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 29 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 new = 1346269 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 new = 2178309 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Column 31 2178309 new = 3524578 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 32 2178309 3524578 new = 5702887 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 33 2178309 3524578 5702887 new = 9227465 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 34 2178309 3524578 5702887 9227465 new = 14930352 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 35 2178309 3524578 5702887 9227465 14930352 new = 24157817 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 36 2178309 3524578 5702887 9227465 14930352 24157817 new = 39088169 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 37 2178309 3...

3   Pass
x =597455000 y_correct = 350704366; assert(isequal(euler002(x),y_correct))

x = 597455000 fib = 1 2 new = 3 fib = 1 2 3 new = 5 fib = 1 2 3 5 new = 8 fib = 1 2 3 5 8 new = 13 fib = 1 2 3 5 8 13 new = 21 fib = 1 2 3 5 8 13 21 new = 34 fib = 1 2 3 5 8 13 21 34 new = 55 fib = 1 2 3 5 8 13 21 34 55 new = 89 fib = 1 2 3 5 8 13 21 34 55 89 new = 144 fib = 1 2 3 5 8 13 21 34 55 89 144 new = 233 fib = 1 2 3 5 8 13 21 34 55 89 144 233 new = 377 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 new = 610 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 new = 987 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 new = 1597 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Column 16 1597 new = 2584 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 17 1597 2584 new = 4181 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 18 1597 2584 4181 new = 6765 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 19 1597 2584 4181 6765 new = 10946 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 20 1597 2584 4181 6765 10946 new = 17711 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 21 1597 2584 4181 6765 10946 17711 new = 28657 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 22 1597 2584 4181 6765 10946 17711 28657 new = 46368 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 23 1597 2584 4181 6765 10946 17711 28657 46368 new = 75025 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 24 1597 2584 4181 6765 10946 17711 28657 46368 75025 new = 121393 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 25 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 new = 196418 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 26 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 new = 317811 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 27 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 new = 514229 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 28 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 new = 832040 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 29 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 new = 1346269 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 new = 2178309 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Column 31 2178309 new = 3524578 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 32 2178309 3524578 new = 5702887 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 33 2178309 3524578 5702887 new = 9227465 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 34 2178309 3524578 5702887 9227465 new = 14930352 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 35 2178309 3524578 5702887 9227465 14930352 new = 24157817 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 36 2178309 3524578 5702887 9227465 14930352 24157817 new = 39088169 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 30 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 Columns 31 through 37 2178309 3...

4   Pass
x =666576 y_correct = 257114; assert(isequal(euler002(x),y_correct))

x = 666576 fib = 1 2 new = 3 fib = 1 2 3 new = 5 fib = 1 2 3 5 new = 8 fib = 1 2 3 5 8 new = 13 fib = 1 2 3 5 8 13 new = 21 fib = 1 2 3 5 8 13 21 new = 34 fib = 1 2 3 5 8 13 21 34 new = 55 fib = 1 2 3 5 8 13 21 34 55 new = 89 fib = 1 2 3 5 8 13 21 34 55 89 new = 144 fib = 1 2 3 5 8 13 21 34 55 89 144 new = 233 fib = 1 2 3 5 8 13 21 34 55 89 144 233 new = 377 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 new = 610 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 new = 987 fib = 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 new = 1597 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Column 16 1597 new = 2584 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 17 1597 2584 new = 4181 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 18 1597 2584 4181 new = 6765 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 19 1597 2584 4181 6765 new = 10946 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 20 1597 2584 4181 6765 10946 new = 17711 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 21 1597 2584 4181 6765 10946 17711 new = 28657 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 22 1597 2584 4181 6765 10946 17711 28657 new = 46368 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 23 1597 2584 4181 6765 10946 17711 28657 46368 new = 75025 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 24 1597 2584 4181 6765 10946 17711 28657 46368 75025 new = 121393 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 25 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 new = 196418 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 26 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 new = 317811 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 27 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 new = 514229 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 28 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 new = 832040 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 29 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 fib = Columns 1 through 15 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 Columns 16 through 28 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 evens = [] evens = 2 evens = 2 8 evens = 2 8 34 evens = 2 8 34 144 evens = 2 8 34 144 610 evens = 2 8 34 144 610 2584 evens = 2 8 34 144 610 2584 10946 evens = 2 8 34 144 610 2584 10946 46368 evens = 2 8 34 144 610 2584 10946 46368 196418 y = 257114