Cody

# Problem 2024. Triangle sequence

Solution 932542

Submitted on 6 Aug 2016 by Oliver Penn
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)

first = 3 second = 4 temp = 0 temp = 5 first = 4 second = 5 area = 25

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

first = 3 second = 4 temp = 0 temp = 5 first = 4 second = 5 temp = 6.4031 first = 5 second = 6.4031 area = 41

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

first = 3 second = 4 temp = 0 temp = 5 first = 4 second = 5 temp = 6.4031 first = 5 second = 6.4031 temp = 8.1240 first = 6.4031 second = 8.1240 area = 66.0000

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

first = 3 second = 4 temp = 0 temp = 5 first = 4 second = 5 temp = 6.4031 first = 5 second = 6.4031 temp = 8.1240 first = 6.4031 second = 8.1240 temp = 10.3441 first = 8.1240 second = 10.3441 temp = 13.1529 first = 10.3441 second = 13.1529 temp = 16.7332 first = 13.1529 second = 16.7332 temp = 21.2838 first = 16.7332 second = 21.2838 temp = 27.0740 first = 21.2838 second = 27.0740 temp = 34.4384 first = 27.0740 second = 34.4384 temp = 43.8064 first = 34.4384 second = 43.8064 temp = 55.7225 first = 43.8064 second = 55.7225 temp = 70.8802 first = 55.7225 second = 70.8802 temp = 90.1610 first = 70.8802 second = 90.1610 temp = 114.6865 first = 90.1610 second = 114.6865 temp = 145.8835 first = 114.6865 second = 145.8835 temp = 185.5667 first = 145.8835 second = 185.5667 temp = 236.0445 first = 185.5667 second = 236.0445 temp = 300.2532 first = 236.0445 second = 300.2532 temp = 381.9280 first = 300.2532 second = 381.9280 temp = 485.8199 first = 381.9280 second = 485.8199 temp = 617.9725 first = 485.8199 second = 617.9725 temp = 786.0732 first = 617.9725 second = 786.0732 temp = 999.9005 first = 786.0732 second = 999.9005 temp = 1.2719e+03 first = 999.9005 second = 1.2719e+03 temp = 1.6179e+03 first = 1.2719e+03 second = 1.6179e+03 temp = 2.0580e+03 first = 1.6179e+03 second = 2.0580e+03 temp = 2.6178e+03 first = 2.0580e+03 second = 2.6178e+03 temp = 3.3299e+03 first = 2.6178e+03 second = 3.3299e+03 temp = 4.2356e+03 first = 3.3299e+03 second = 4.2356e+03 temp = 5.3878e+03 first = 4.2356e+03 second = 5.3878e+03 temp = 6.8534e+03 first = 5.3878e+03 second = 6.8534e+03 temp = 8.7177e+03 first = 6.8534e+03 second = 8.7177e+03 temp = 1.1089e+04 first = 8.7177e+03 second = 1.1089e+04 temp = 1.4106e+04 first = 1.1089e+04 second = 1.4106e+04 temp = 1.7942e+04 first = 1.4106e+04 second = 1.7942e+04 temp = 2.2823e+04 first = 1.7942e+04 second = 2.2823e+04 temp = 2.9032e+04 first = 2.2823e+04 second = 2.9032e+04 temp = 3.6929e+04 first = 2.9032e+04 second = 3.6929e+04 temp = 4.6974e+04 first = 3.6929e+04 second = 4.6974e+04 temp = 5.9752e+04 first = 4.6974e+04 second = 5.9752e+04 temp = 7.6006e+04 first = 5.9752e+04 second = 7.6006e+04 temp = 9.6681e+04 first = 7.6006e+04 second = 9.6681e+04 temp = 1.2298e+05 first = 9.6681e+04 second = 1.2298e+05 temp = 1.5643e+05 first = 1.2298e+05 second = 1.5643e+05 temp = 1.9899e+05 first = 1.5643e+05 second = 1.9899e+05 temp = 2.5311e+05 first = 1.9899e+05 second = 2.5311e+05 temp = 3.2196e+05 first = 2.5311e+05 second = 3.2196e+05 temp = 4.0955e+05 first = 3.2196e+05 second = 4.0955e+05 temp = 5.2095e+05 first = 4.0955e+05 second = 5.2095e+05 temp = 6.6266e+05 first = 5.2095e+05 second = 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!