Cody

# Problem 2024. Triangle sequence

Solution 792406

Submitted on 10 Dec 2015 by Akansha Saxena
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)

sides = 9 16 25 area = 25

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

sides = 9 16 25 sides = 9 16 25 9 16 25 sides = 9 16 25 9 25 25 sides = 9 16 25 16 25 25 sides = 9 16 25 16 25 41 area = 41

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

sides = 9 16 25 sides = 9 16 25 9 16 25 sides = 9 16 25 9 25 25 sides = 9 16 25 16 25 25 sides = 9 16 25 16 25 41 sides = 9 16 25 16 25 41 16 25 41 sides = 9 16 25 16 25 41 16 41 41 sides = 9 16 25 16 25 41 25 41 41 sides = 9 16 25 16 25 41 25 41 66 area = 66

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

sides = 9 16 25 sides = 9 16 25 9 16 25 sides = 9 16 25 9 25 25 sides = 9 16 25 16 25 25 sides = 9 16 25 16 25 41 sides = 9 16 25 16 25 41 16 25 41 sides = 9 16 25 16 25 41 16 41 41 sides = 9 16 25 16 25 41 25 41 41 sides = 9 16 25 16 25 41 25 41 66 sides = 9 16 25 16 25 41 25 41 66 25 41 66 sides = 9 16 25 16 25 41 25 41 66 25 66 66 sides = 9 16 25 16 25 41 25 41 66 41 66 66 sides = 9 16 25 16 25 41 25 41 66 41 66 107 sides = 9 16 25 16 25 41 25 41 66 41 66 107 41 66 107 sides = 9 16 25 16 25 41 25 41 66 41 66 107 41 107 107 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 107 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 66 107 173 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 66 173 173 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 173 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 107 173 280 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 107 280 280 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 280 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 173 280 453 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 173 453 453 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 453 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 280 453 733 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 280 733 733 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 733 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 453 733 1186 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 453 1186 1186 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1186 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 733 1186 1919 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 733 1919 1919 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 1919 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1186 1919 3105 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1186 3105 3105 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1919 3105 3105 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1919 3105 5024 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1919 3105 5024 1919 3105 5024 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 280 453 280 453 733 453 733 1186 733 1186 1919 1186 1919 3105 1919 3105 5024 1919 5024 5024 sides = 9 16 25 16 25 41 25 41 66 41 66 107 66 107 173 107 173 280 173 2...