Cody

# Problem 2024. Triangle sequence

Solution 1881966

Submitted on 23 Jul 2019 by Paul Smits
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)

ans = 9 16 25 ans = 25

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

ans = 9 16 25 ans = 9 16 25 41 ans = 41

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

ans = 9 16 25 ans = 9 16 25 41 ans = 9 16 25 41 66 ans = 66

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

ans = 9 16 25 ans = 9 16 25 41 ans = 9 16 25 41 66 ans = 9 16 25 41 66 107 ans = 9 16 25 41 66 107 173 ans = 9 16 25 41 66 107 173 280 ans = 9 16 25 41 66 107 173 280 453 ans = 9 16 25 41 66 107 173 280 453 733 ans = 9 16 25 41 66 107 173 280 453 733 1186 ans = 9 16 25 41 66 107 173 280 453 733 1186 1919 ans = 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 ans = 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 ans = 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Column 16 13153 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 17 13153 21282 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 18 13153 21282 34435 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 19 13153 21282 34435 55717 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 20 13153 21282 34435 55717 90152 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 21 13153 21282 34435 55717 90152 145869 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 22 13153 21282 34435 55717 90152 145869 236021 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 23 13153 21282 34435 55717 90152 145869 236021 381890 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 24 13153 21282 34435 55717 90152 145869 236021 381890 617911 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 25 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 26 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 27 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 28 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 29 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Column 31 17940701 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 32 17940701 29028664 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 33 17940701 29028664 46969365 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 34 17940701 29028664 46969365 75998029 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 35 17940701 29028664 46969365 75998029 122967394 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 36 17940701 29028664 46969365 75998029 122967394 198965423 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 55717 90152 145869 236021 381890 617911 999801 1617712 2617513 4235225 6852738 11087963 Columns 31 through 37 17940701 29028664 46969365 75998029 122967394 198965423 321932817 ans = Columns 1 through 15 9 16 25 41 66 107 173 280 453 733 1186 1919 3105 5024 8129 Columns 16 through 30 13153 21282 34435 ...