Cody

Problem 2024. Triangle sequence

Solution 1906373

Submitted on 20 Aug 2019 by Eugene Avrutin
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)

smallest = 7 second = 9 temp = 9 second = 16 smallest = 9 area = 25

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

smallest = 7 second = 9 temp = 9 second = 16 smallest = 9 temp = 16 second = 25 smallest = 16 area = 41

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

smallest = 7 second = 9 temp = 9 second = 16 smallest = 9 temp = 16 second = 25 smallest = 16 temp = 25 second = 41 smallest = 25 area = 66

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

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