Cody

# Problem 1946. Fibonacci-Sum of Squares

Solution 1394256

Submitted on 26 Dec 2017 by Mahadev Krishnan
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))

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 ans = 40

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

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 s = 1 1 4 9 25 64 s = 1 1 4 9 25 64 169 s = 1 1 4 9 25 64 169 441 ans = 714

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

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 s = 1 1 4 9 25 64 s = 1 1 4 9 25 64 169 s = 1 1 4 9 25 64 169 441 s = 1 1 4 9 25 64 169 441 1156 s = 1 1 4 9 25 64 169 441 1156 3025 s = 1 1 4 9 25 64 169 441 1156 3025 7921 ans = 12816

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

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 s = 1 1 4 9 25 64 s = 1 1 4 9 25 64 169 s = 1 1 4 9 25 64 169 441 s = 1 1 4 9 25 64 169 441 1156 s = 1 1 4 9 25 64 169 441 1156 3025 s = 1 1 4 9 25 64 169 441 1156 3025 7921 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Column 15 372100 ans = 602070

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

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 s = 1 1 4 9 25 64 s = 1 1 4 9 25 64 169 s = 1 1 4 9 25 64 169 441 s = 1 1 4 9 25 64 169 441 1156 s = 1 1 4 9 25 64 169 441 1156 3025 s = 1 1 4 9 25 64 169 441 1156 3025 7921 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Column 15 372100 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 16 372100 974169 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 17 372100 974169 2550409 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 18 372100 974169 2550409 6677056 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 19 372100 974169 2550409 6677056 17480761 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 20 372100 974169 2550409 6677056 17480761 45765225 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 21 372100 974169 2550409 6677056 17480761 45765225 119814916 ans = 193864606

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

s = 1 1 4 s = 1 1 4 9 s = 1 1 4 9 25 s = 1 1 4 9 25 64 s = 1 1 4 9 25 64 169 s = 1 1 4 9 25 64 169 441 s = 1 1 4 9 25 64 169 441 1156 s = 1 1 4 9 25 64 169 441 1156 3025 s = 1 1 4 9 25 64 169 441 1156 3025 7921 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 s = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Column 15 372100 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 16 372100 974169 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 17 372100 974169 2550409 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 18 372100 974169 2550409 6677056 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 19 372100 974169 2550409 6677056 17480761 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 20 372100 974169 2550409 6677056 17480761 45765225 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 21 372100 974169 2550409 6677056 17480761 45765225 119814916 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 22 372100 974169 2550409 6677056 17480761 45765225 119814916 313679521 s = Columns 1 through 14 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 Columns 15 through 23 372100 974169 2550409 6677056 17480761 45765225 119814916 313679521 821223649 s = 1.0e+09 * Columns 1 through 17 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0004 0.0010 0.0026 Columns 18 through 24 0.0067 0.0175 0.0458 0.1198 0.3137 0.8212 2.1500 s = 1.0e+09 * Columns 1 through 17 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 0.0004 0.0010 0.0026 Columns 18 through 25 0.0067 0.0175 0.0458 0.1198 0.3137 0.8212 2.1500 5.6288 s = 1.0e+10 * Columns 1 through 17 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0003 Columns 18 through 26 0.0007 0.0017 0.0046 0.0120 0.0314 0.0821 0.2150 0.5629 1.4736 ans = 2.3844e+10