Cody

# Problem 2024. Triangle sequence

Solution 1754847

Submitted on 19 Mar 2019 by Jason Casey
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 = 25 a = 25 41 a = 25 41 66 area = 25

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

a = 25 a = 25 41 a = 25 41 66 a = 25 41 66 107 area = 41

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

a = 25 a = 25 41 a = 25 41 66 a = 25 41 66 107 a = 25 41 66 107 173 area = 66

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

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

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!