Cody

# Problem 1946. Fibonacci-Sum of Squares

Solution 2076765

Submitted on 2 Jan 2020 by Jonas Oliveira
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))

FS3 = [] FS2 = 1 FS3 = 1 FS2 = 1 FS3 = 1 1 FS2 = 4 FS3 = 1 1 4 FS2 = 9 FS3 = 1 1 4 9 FS2 = 25 FS3 = 1 1 4 9 25 S = 40

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

FS3 = [] FS2 = 1 FS3 = 1 FS2 = 1 FS3 = 1 1 FS2 = 4 FS3 = 1 1 4 FS2 = 9 FS3 = 1 1 4 9 FS2 = 25 FS3 = 1 1 4 9 25 FS2 = 64 FS3 = 1 1 4 9 25 64 FS2 = 169 FS3 = 1 1 4 9 25 64 169 FS2 = 441 FS3 = 1 1 4 9 25 64 169 441 S = 714

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

FS3 = [] FS2 = 1 FS3 = 1 FS2 = 1 FS3 = 1 1 FS2 = 4 FS3 = 1 1 4 FS2 = 9 FS3 = 1 1 4 9 FS2 = 25 FS3 = 1 1 4 9 25 FS2 = 64 FS3 = 1 1 4 9 25 64 FS2 = 169 FS3 = 1 1 4 9 25 64 169 FS2 = 441 FS3 = 1 1 4 9 25 64 169 441 FS2 = 1156 FS3 = 1 1 4 9 25 64 169 441 1156 FS2 = 3025 FS3 = 1 1 4 9 25 64 169 441 1156 3025 FS2 = 7921 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 S = 12816

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

FS3 = [] FS2 = 1 FS3 = 1 FS2 = 1 FS3 = 1 1 FS2 = 4 FS3 = 1 1 4 FS2 = 9 FS3 = 1 1 4 9 FS2 = 25 FS3 = 1 1 4 9 25 FS2 = 64 FS3 = 1 1 4 9 25 64 FS2 = 169 FS3 = 1 1 4 9 25 64 169 FS2 = 441 FS3 = 1 1 4 9 25 64 169 441 FS2 = 1156 FS3 = 1 1 4 9 25 64 169 441 1156 FS2 = 3025 FS3 = 1 1 4 9 25 64 169 441 1156 3025 FS2 = 7921 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 FS2 = 20736 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 FS2 = 54289 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 FS2 = 142129 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 FS2 = 372100 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 S = 602070

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

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

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

FS3 = [] FS2 = 1 FS3 = 1 FS2 = 1 FS3 = 1 1 FS2 = 4 FS3 = 1 1 4 FS2 = 9 FS3 = 1 1 4 9 FS2 = 25 FS3 = 1 1 4 9 25 FS2 = 64 FS3 = 1 1 4 9 25 64 FS2 = 169 FS3 = 1 1 4 9 25 64 169 FS2 = 441 FS3 = 1 1 4 9 25 64 169 441 FS2 = 1156 FS3 = 1 1 4 9 25 64 169 441 1156 FS2 = 3025 FS3 = 1 1 4 9 25 64 169 441 1156 3025 FS2 = 7921 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 FS2 = 20736 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 FS2 = 54289 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 FS2 = 142129 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 FS2 = 372100 FS3 = 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 FS2 = 974169 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Column 16 974169 FS2 = 2550409 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 17 974169 2550409 FS2 = 6677056 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 18 974169 2550409 6677056 FS2 = 17480761 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 19 974169 2550409 6677056 17480761 FS2 = 45765225 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 20 974169 2550409 6677056 17480761 45765225 FS2 = 119814916 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 21 974169 2550409 6677056 17480761 45765225 119814916 FS2 = 313679521 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 22 974169 2550409 6677056 17480761 45765225 119814916 313679521 FS2 = 821223649 FS3 = Columns 1 through 15 1 1 4 9 25 64 169 441 1156 3025 7921 20736 54289 142129 372100 Columns 16 through 23 974169 2550409 6677056 17480761 45765225 119814916 313679521 821223649 FS2 = 2.1500e+09 FS3 = 1.0e+09 * Columns 1 through 18 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 0.0067 Columns 19 through 24 0.0175 0.0458 0.1198 0.3137 0.8212 2.1500 FS2 = 5.6288e+09 FS3 = 1.0e+09 * Columns 1 through 18 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 0.0067 Columns 19 through 25 0.0175 0.0458 0.1198 0.3137 0.8212 2.1500 5.6288 FS2 = 1.4736e+10 FS3 = 1.0e+10 * Columns 1 through 18 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 0.0007 Columns 19 through 26 0.0017 0.0046 0.0120 0.0314 0.0821 0.2150 0.5629 1.4736 S = 2.3844e+10