Cody

# Problem 2024. Triangle sequence

Solution 361925

Submitted on 29 Nov 2013 by Richard Zapor
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)

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

tri = 16 25 41

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

tri = 16 25 41 tri = 25 41 66

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

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