Cody

# Problem 2024. Triangle sequence

Solution 1985691

Submitted on 22 Oct 2019 by Hieu Tran
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)

a = 9 b = 16 temp = 16 b = 25 a = 16 area = 25

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

a = 9 b = 16 temp = 16 b = 25 a = 16 temp = 25 b = 41 a = 25 area = 41

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

a = 9 b = 16 temp = 16 b = 25 a = 16 temp = 25 b = 41 a = 25 temp = 41 b = 66 a = 41 area = 66

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

a = 9 b = 16 temp = 16 b = 25 a = 16 temp = 25 b = 41 a = 25 temp = 41 b = 66 a = 41 temp = 66 b = 107 a = 66 temp = 107 b = 173 a = 107 temp = 173 b = 280 a = 173 temp = 280 b = 453 a = 280 temp = 453 b = 733 a = 453 temp = 733 b = 1186 a = 733 temp = 1186 b = 1919 a = 1186 temp = 1919 b = 3105 a = 1919 temp = 3105 b = 5024 a = 3105 temp = 5024 b = 8129 a = 5024 temp = 8129 b = 13153 a = 8129 temp = 13153 b = 21282 a = 13153 temp = 21282 b = 34435 a = 21282 temp = 34435 b = 55717 a = 34435 temp = 55717 b = 90152 a = 55717 temp = 90152 b = 145869 a = 90152 temp = 145869 b = 236021 a = 145869 temp = 236021 b = 381890 a = 236021 temp = 381890 b = 617911 a = 381890 temp = 617911 b = 999801 a = 617911 temp = 999801 b = 1617712 a = 999801 temp = 1617712 b = 2617513 a = 1617712 temp = 2617513 b = 4235225 a = 2617513 temp = 4235225 b = 6852738 a = 4235225 temp = 6852738 b = 11087963 a = 6852738 temp = 11087963 b = 17940701 a = 11087963 temp = 17940701 b = 29028664 a = 17940701 temp = 29028664 b = 46969365 a = 29028664 temp = 46969365 b = 75998029 a = 46969365 temp = 75998029 b = 122967394 a = 75998029 temp = 122967394 b = 198965423 a = 122967394 temp = 198965423 b = 321932817 a = 198965423 temp = 321932817 b = 520898240 a = 321932817 temp = 520898240 b = 842831057 a = 520898240 temp = 842831057 b = 1.3637e+09 a = 842831057 temp = 1.3637e+09 b = 2.2066e+09 a = 1.3637e+09 temp = 2.2066e+09 b = 3.5703e+09 a = 2.2066e+09 temp = 3.5703e+09 b = 5.7769e+09 a = 3.5703e+09 temp = 5.7769e+09 b = 9.3471e+09 a = 5.7769e+09 temp = 9.3471e+09 b = 1.5124e+10 a = 9.3471e+09 temp = 1.5124e+10 b = 2.4471e+10 a = 1.5124e+10 temp = 2.4471e+10 b = 3.9595e+10 a = 2.4471e+10 temp = 3.9595e+10 b = 6.4066e+10 a = 3.9595e+10 temp = 6.4066e+10 b = 1.0366e+11 a = 6.4066e+10 temp = 1.0366e+11 b = 1.6773e+11 a = 1.0366e+11 temp = 1.6773e+11 b = 2.7139e+11 a = 1.6773e+11 temp = 2.7139e+11 b = 4.3912e+11 a = 2.7139e+11 area = 4.3912e+11