Cody

# Problem 2024. Triangle sequence

Solution 2102830

Submitted on 23 Jan 2020 by Andrew Tran
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)

r = 1 hyp = 5 side2l = 4 side1l = 3 area = 25

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

r = 1 hyp = 5 side2l = 4 side1l = 3 area = 25 side1l = 4 side2l = 5 hyp = 6.4031 r = 3 area = 41

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

r = 1 hyp = 5 side2l = 4 side1l = 3 area = 25 side1l = 4 side2l = 5 hyp = 6.4031 r = 3 area = 41 side1l = 5 side2l = 6.4031 hyp = 8.1240 r = 4 area = 66.0000

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

r = 1 hyp = 5 side2l = 4 side1l = 3 area = 25 side1l = 4 side2l = 5 hyp = 6.4031 r = 3 area = 41 side1l = 5 side2l = 6.4031 hyp = 8.1240 r = 4 area = 66.0000 side1l = 6.4031 side2l = 8.1240 hyp = 10.3441 r = 5 area = 107.0000 side1l = 8.1240 side2l = 10.3441 hyp = 13.1529 r = 6 area = 173.0000 side1l = 10.3441 side2l = 13.1529 hyp = 16.7332 r = 7 area = 280 side1l = 13.1529 side2l = 16.7332 hyp = 21.2838 r = 8 area = 453 side1l = 16.7332 side2l = 21.2838 hyp = 27.0740 r = 9 area = 733 side1l = 21.2838 side2l = 27.0740 hyp = 34.4384 r = 10 area = 1.1860e+03 side1l = 27.0740 side2l = 34.4384 hyp = 43.8064 r = 11 area = 1.9190e+03 side1l = 34.4384 side2l = 43.8064 hyp = 55.7225 r = 12 area = 3.1050e+03 side1l = 43.8064 side2l = 55.7225 hyp = 70.8802 r = 13 area = 5.0240e+03 side1l = 55.7225 side2l = 70.8802 hyp = 90.1610 r = 14 area = 8.1290e+03 side1l = 70.8802 side2l = 90.1610 hyp = 114.6865 r = 15 area = 1.3153e+04 side1l = 90.1610 side2l = 114.6865 hyp = 145.8835 r = 16 area = 2.1282e+04 side1l = 114.6865 side2l = 145.8835 hyp = 185.5667 r = 17 area = 3.4435e+04 side1l = 145.8835 side2l = 185.5667 hyp = 236.0445 r = 18 area = 5.5717e+04 side1l = 185.5667 side2l = 236.0445 hyp = 300.2532 r = 19 area = 90152 side1l = 236.0445 side2l = 300.2532 hyp = 381.9280 r = 20 area = 1.4587e+05 side1l = 300.2532 side2l = 381.9280 hyp = 485.8199 r = 21 area = 2.3602e+05 side1l = 381.9280 side2l = 485.8199 hyp = 617.9725 r = 22 area = 3.8189e+05 side1l = 485.8199 side2l = 617.9725 hyp = 786.0732 r = 23 area = 6.1791e+05 side1l = 617.9725 side2l = 786.0732 hyp = 999.9005 r = 24 area = 9.9980e+05 side1l = 786.0732 side2l = 999.9005 hyp = 1.2719e+03 r = 25 area = 1.6177e+06 side1l = 999.9005 side2l = 1.2719e+03 hyp = 1.6179e+03 r = 26 area = 2.6175e+06 side1l = 1.2719e+03 side2l = 1.6179e+03 hyp = 2.0580e+03 r = 27 area = 4.2352e+06 side1l = 1.6179e+03 side2l = 2.0580e+03 hyp = 2.6178e+03 r = 28 area = 6.8527e+06 side1l = 2.0580e+03 side2l = 2.6178e+03 hyp = 3.3299e+03 r = 29 area = 1.1088e+07 side1l = 2.6178e+03 side2l = 3.3299e+03 hyp = 4.2356e+03 r = 30 area = 1.7941e+07 side1l = 3.3299e+03 side2l = 4.2356e+03 hyp = 5.3878e+03 r = 31 area = 2.9029e+07 side1l = 4.2356e+03 side2l = 5.3878e+03 hyp = 6.8534e+03 r = 32 area = 4.6969e+07 side1l = 5.3878e+03 side2l = 6.8534e+03 hyp = 8.7177e+03 r = 33 area = 7.5998e+07 side1l = 6.8534e+03 side2l = 8.7177e+03 hyp = 1.1089e+04 r = 34 area = 1.2297e+08 side1l = 8.7177e+03 side2l = 1.1089e+04 hyp = 1.4106e+04 r = 35 area = 1.9897e+08 side1l = 1.1089e+04 side2l = 1.4106e+04 hyp = 1.7942e+04 r = 36 area = 3.2193e+08 side1l = 1.4106e+04 side2l = 1.7942e+04 hyp = 2.2823e+04 r = 37 area = 5.2090e+08 side1l = 1.7942e+04 side2l = 2.2823e+04 hyp = 2.9032e+04 r = 38 area = 8.4283e+08 side1l = 2.2823e+04 side2l = 2.9032e+04 hyp = 3.6929e+04 r = 39 area = 1.3637e+09 side1l = 2.9032e+04 side2l = 3.6929e+04 hyp = 4.6974e+04 r = 40 area = 2.2066e+09 side1l = 3.6929e+04 side2l = 4.6974e+04 hyp = 5.9752e+04 r = 41 area = 3.5703e+09 side1l = 4.6974e+04 side2l = 5.9752e+04 hyp = 7.6006e+04 r = 42 area = 5.7769e+09 side1l = 5.9752e+04 side2l = 7.6006e+04 hyp = 9.6681e+04 r = 43 area = 9.3471e+09 side1l = 7.6006e+04 side2l = 9.6681e+04 hyp = 1.2298e+05 r = 44 area = 1.5124e+10 side1l = 9.6681e+04 side2l = 1.2298e+05 hyp = 1.5643e+05 r = 45 area = 2.4471e+10 side1l = 1.2298e+05 side2l = 1.5643e+05 hyp = 1.9899e+05 r = 46 area = 3.9595e+10 side1l = 1.5643e+05 side2l = 1.9899e+05 hyp = 2.5311e+05 r = 47 area = 6.4066e+10 side1l = 1.9899e+05 side2l = 2.5311e+05 hyp = 3.2196e+05 r = 48 area = 1.0366e+11 side1l = 2.5311e+05 side2l = 3.2196e+05 hyp = 4.0955e+05 r = 49 area = 1.6773e+11 side1l = 3.2196e+05 side2l = 4.0955e+05 hyp = 5.2095e+05 r = 50 area = 2.7139e+11 side1l = 4.0955e+05 side2l = 5.2095e+05 hyp = 6.6266e+05 r = 51 area = 4.3912e+11