Cody

Problem 2024. Triangle sequence

Solution 2257349

Submitted on 6 May 2020 by Anvitha S
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)

area = 25

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

l = 5 b = 4 l1 = 5 b1 = 4 h1 = 6.4031 area = 41

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

l = 5 b = 4 l1 = 5 b1 = 4 h1 = 6.4031 l = 6.4031 b = 5 l1 = 6.4031 b1 = 5 h1 = 8.1240 area = 66.0000

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

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

Community Treasure Hunt

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

Start Hunting!