Cody

# Problem 2024. Triangle sequence

Solution 3211878

Submitted on 14 Oct 2020 by Rao Fu
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 = 1; area_correct = 25; tolerance = 1e-12; assert(abs(triangle_sequence(n)-area_correct)<tolerance)

x = 0 1 x = 0 1 1 area = 25

2   Pass
n = 2; area_correct = 41; tolerance = 1e-12; assert(abs(triangle_sequence(n)-area_correct)<tolerance)

x = 0 1 x = 0 1 1 x = 0 1 1 2 area = 41

3   Pass
n = 3; area_correct = 66; tolerance = 1e-12; assert(abs(triangle_sequence(n)-area_correct)<tolerance)

x = 0 1 x = 0 1 1 x = 0 1 1 2 x = 0 1 1 2 3 area = 66

4   Pass
n = 50; area_correct = 439116598409; tolerance = 1e-3; assert(abs(triangle_sequence(n)-area_correct)<tolerance)

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

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!