Cody

# Problem 1946. Fibonacci-Sum of Squares

Solution 1907727

Submitted on 21 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
n = 5; S = 40; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 S = 40

2   Pass
n = 8; S = 714; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 next = 8 sum = 104 second = 5 first = 8 next = 13 sum = 273 second = 8 first = 13 next = 21 sum = 714 second = 13 first = 21 S = 714

3   Pass
n = 11; S = 12816; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 next = 8 sum = 104 second = 5 first = 8 next = 13 sum = 273 second = 8 first = 13 next = 21 sum = 714 second = 13 first = 21 next = 34 sum = 1870 second = 21 first = 34 next = 55 sum = 4895 second = 34 first = 55 next = 89 sum = 12816 second = 55 first = 89 S = 12816

4   Pass
n = 15; S = 602070; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 next = 8 sum = 104 second = 5 first = 8 next = 13 sum = 273 second = 8 first = 13 next = 21 sum = 714 second = 13 first = 21 next = 34 sum = 1870 second = 21 first = 34 next = 55 sum = 4895 second = 34 first = 55 next = 89 sum = 12816 second = 55 first = 89 next = 144 sum = 33552 second = 89 first = 144 next = 233 sum = 87841 second = 144 first = 233 next = 377 sum = 229970 second = 233 first = 377 next = 610 sum = 602070 second = 377 first = 610 S = 602070

5   Pass
n = 21; S = 193864606; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 next = 8 sum = 104 second = 5 first = 8 next = 13 sum = 273 second = 8 first = 13 next = 21 sum = 714 second = 13 first = 21 next = 34 sum = 1870 second = 21 first = 34 next = 55 sum = 4895 second = 34 first = 55 next = 89 sum = 12816 second = 55 first = 89 next = 144 sum = 33552 second = 89 first = 144 next = 233 sum = 87841 second = 144 first = 233 next = 377 sum = 229970 second = 233 first = 377 next = 610 sum = 602070 second = 377 first = 610 next = 987 sum = 1576239 second = 610 first = 987 next = 1597 sum = 4126648 second = 987 first = 1597 next = 2584 sum = 10803704 second = 1597 first = 2584 next = 4181 sum = 28284465 second = 2584 first = 4181 next = 6765 sum = 74049690 second = 4181 first = 6765 next = 10946 sum = 193864606 second = 6765 first = 10946 S = 193864606

6   Pass
n = 26; S = 23843770274; assert(isequal(FibSumSquares(n),S))

first = 0 second = 1 sum = 0 next = 1 sum = 1 second = 0 first = 1 next = 1 sum = 2 second = 1 first = 1 next = 2 sum = 6 second = 1 first = 2 next = 3 sum = 15 second = 2 first = 3 next = 5 sum = 40 second = 3 first = 5 next = 8 sum = 104 second = 5 first = 8 next = 13 sum = 273 second = 8 first = 13 next = 21 sum = 714 second = 13 first = 21 next = 34 sum = 1870 second = 21 first = 34 next = 55 sum = 4895 second = 34 first = 55 next = 89 sum = 12816 second = 55 first = 89 next = 144 sum = 33552 second = 89 first = 144 next = 233 sum = 87841 second = 144 first = 233 next = 377 sum = 229970 second = 233 first = 377 next = 610 sum = 602070 second = 377 first = 610 next = 987 sum = 1576239 second = 610 first = 987 next = 1597 sum = 4126648 second = 987 first = 1597 next = 2584 sum = 10803704 second = 1597 first = 2584 next = 4181 sum = 28284465 second = 2584 first = 4181 next = 6765 sum = 74049690 second = 4181 first = 6765 next = 10946 sum = 193864606 second = 6765 first = 10946 next = 17711 sum = 507544127 second = 10946 first = 17711 next = 28657 sum = 1.3288e+09 second = 17711 first = 28657 next = 46368 sum = 3.4788e+09 second = 28657 first = 46368 next = 75025 sum = 9.1075e+09 second = 46368 first = 75025 next = 121393 sum = 2.3844e+10 second = 75025 first = 121393 S = 2.3844e+10