Cody

# Problem 1946. Fibonacci-Sum of Squares

Solution 1716220

Submitted on 28 Jan 2019 by James Best
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))

sequence = 1 3 8 21 55 2 5 13 34 89 y = 1 1 2 3 5 8 13 21 34 55 89 144 yout = 1 1 2 3 5 S = 40

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

sequence = 1 3 8 21 55 144 377 987 2 5 13 34 89 233 610 1597 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 18 987 1597 2584 yout = 1 1 2 3 5 8 13 21 S = 714

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

sequence = 1 3 8 21 55 144 377 987 2584 6765 17711 2 5 13 34 89 233 610 1597 4181 10946 28657 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 24 987 1597 2584 4181 6765 10946 17711 28657 46368 yout = 1 1 2 3 5 8 13 21 34 55 89 S = 12816

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

sequence = 1 3 8 21 55 144 377 987 2584 6765 17711 46368 121393 317811 832040 2 5 13 34 89 233 610 1597 4181 10946 28657 75025 196418 514229 1346269 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 32 1346269 2178309 yout = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 S = 602070

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

sequence = Columns 1 through 15 1 3 8 21 55 144 377 987 2584 6765 17711 46368 121393 317811 832040 2 5 13 34 89 233 610 1597 4181 10946 28657 75025 196418 514229 1346269 Columns 16 through 21 2178309 5702887 14930352 39088169 102334155 267914296 3524578 9227465 24157817 63245986 165580141 433494437 y = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 30 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 Columns 31 through 44 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 yout = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 21 987 1597 2584 4181 6765 10946 S = 193864606

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

sequence = 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.0001 0.0002 0.0006 0.0015 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.0001 0.0004 0.0009 0.0024 Columns 19 through 26 0.0039 0.0102 0.0268 0.0701 0.1836 0.4808 1.2586 3.2951 0.0063 0.0166 0.0433 0.1135 0.2971 0.7779 2.0365 5.3316 y = 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.0000 0.0000 0.0000 Columns 19 through 36 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.0001 0.0002 0.0004 0.0006 0.0009 0.0015 Columns 37 through 54 0.0024 0.0039 0.0063 0.0102 0.0166 0.0268 0.0433 0.0701 0.1135 0.1836 0.2971 0.4808 0.7779 1.2586 2.0365 3.2951 5.3316 8.6268 yout = Columns 1 through 15 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 Columns 16 through 26 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 S = 2.3844e+10