Cody

# Problem 2024. Triangle sequence

Solution 2021269

Submitted on 14 Nov 2019 by Alexander Schröder
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)

h = 4 l = 3 s = 1 s = 3 l = 4 h = 5 area = 25

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

h = 4 l = 3 s = 1 s = 3 l = 4 h = 5 s = 4 l = 5 h = 6.4031 area = 41

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

h = 4 l = 3 s = 1 s = 3 l = 4 h = 5 s = 4 l = 5 h = 6.4031 s = 5 l = 6.4031 h = 8.1240 area = 66.0000

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

h = 4 l = 3 s = 1 s = 3 l = 4 h = 5 s = 4 l = 5 h = 6.4031 s = 5 l = 6.4031 h = 8.1240 s = 6.4031 l = 8.1240 h = 10.3441 s = 8.1240 l = 10.3441 h = 13.1529 s = 10.3441 l = 13.1529 h = 16.7332 s = 13.1529 l = 16.7332 h = 21.2838 s = 16.7332 l = 21.2838 h = 27.0740 s = 21.2838 l = 27.0740 h = 34.4384 s = 27.0740 l = 34.4384 h = 43.8064 s = 34.4384 l = 43.8064 h = 55.7225 s = 43.8064 l = 55.7225 h = 70.8802 s = 55.7225 l = 70.8802 h = 90.1610 s = 70.8802 l = 90.1610 h = 114.6865 s = 90.1610 l = 114.6865 h = 145.8835 s = 114.6865 l = 145.8835 h = 185.5667 s = 145.8835 l = 185.5667 h = 236.0445 s = 185.5667 l = 236.0445 h = 300.2532 s = 236.0445 l = 300.2532 h = 381.9280 s = 300.2532 l = 381.9280 h = 485.8199 s = 381.9280 l = 485.8199 h = 617.9725 s = 485.8199 l = 617.9725 h = 786.0732 s = 617.9725 l = 786.0732 h = 999.9005 s = 786.0732 l = 999.9005 h = 1.2719e+03 s = 999.9005 l = 1.2719e+03 h = 1.6179e+03 s = 1.2719e+03 l = 1.6179e+03 h = 2.0580e+03 s = 1.6179e+03 l = 2.0580e+03 h = 2.6178e+03 s = 2.0580e+03 l = 2.6178e+03 h = 3.3299e+03 s = 2.6178e+03 l = 3.3299e+03 h = 4.2356e+03 s = 3.3299e+03 l = 4.2356e+03 h = 5.3878e+03 s = 4.2356e+03 l = 5.3878e+03 h = 6.8534e+03 s = 5.3878e+03 l = 6.8534e+03 h = 8.7177e+03 s = 6.8534e+03 l = 8.7177e+03 h = 1.1089e+04 s = 8.7177e+03 l = 1.1089e+04 h = 1.4106e+04 s = 1.1089e+04 l = 1.4106e+04 h = 1.7942e+04 s = 1.4106e+04 l = 1.7942e+04 h = 2.2823e+04 s = 1.7942e+04 l = 2.2823e+04 h = 2.9032e+04 s = 2.2823e+04 l = 2.9032e+04 h = 3.6929e+04 s = 2.9032e+04 l = 3.6929e+04 h = 4.6974e+04 s = 3.6929e+04 l = 4.6974e+04 h = 5.9752e+04 s = 4.6974e+04 l = 5.9752e+04 h = 7.6006e+04 s = 5.9752e+04 l = 7.6006e+04 h = 9.6681e+04 s = 7.6006e+04 l = 9.6681e+04 h = 1.2298e+05 s = 9.6681e+04 l = 1.2298e+05 h = 1.5643e+05 s = 1.2298e+05 l = 1.5643e+05 h = 1.9899e+05 s = 1.5643e+05 l = 1.9899e+05 h = 2.5311e+05 s = 1.9899e+05 l = 2.5311e+05 h = 3.2196e+05 s = 2.5311e+05 l = 3.2196e+05 h = 4.0955e+05 s = 3.2196e+05 l = 4.0955e+05 h = 5.2095e+05 s = 4.0955e+05 l = 5.2095e+05 h = 6.6266e+05 area = 4.3912e+11