Cody

Problem 2024. Triangle sequence

Solution 3264148

Submitted on 18 Oct 2020 by Gautam Rawat
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)

ans = 25

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

temp = 3 b = 4 p = 5 i = 1 ans = 41

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

temp = 3 b = 4 p = 5 i = 1 temp = 4 b = 5 p = 6.4031 i = 2 ans = 66

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

temp = 3 b = 4 p = 5 i = 1 temp = 4 b = 5 p = 6.4031 i = 2 temp = 5 b = 6.4031 p = 8.1240 i = 3 temp = 6.4031 b = 8.1240 p = 10.3441 i = 4 temp = 8.1240 b = 10.3441 p = 13.1529 i = 5 temp = 10.3441 b = 13.1529 p = 16.7332 i = 6 temp = 13.1529 b = 16.7332 p = 21.2838 i = 7 temp = 16.7332 b = 21.2838 p = 27.0740 i = 8 temp = 21.2838 b = 27.0740 p = 34.4384 i = 9 temp = 27.0740 b = 34.4384 p = 43.8064 i = 10 temp = 34.4384 b = 43.8064 p = 55.7225 i = 11 temp = 43.8064 b = 55.7225 p = 70.8802 i = 12 temp = 55.7225 b = 70.8802 p = 90.1610 i = 13 temp = 70.8802 b = 90.1610 p = 114.6865 i = 14 temp = 90.1610 b = 114.6865 p = 145.8835 i = 15 temp = 114.6865 b = 145.8835 p = 185.5667 i = 16 temp = 145.8835 b = 185.5667 p = 236.0445 i = 17 temp = 185.5667 b = 236.0445 p = 300.2532 i = 18 temp = 236.0445 b = 300.2532 p = 381.9280 i = 19 temp = 300.2532 b = 381.9280 p = 485.8199 i = 20 temp = 381.9280 b = 485.8199 p = 617.9725 i = 21 temp = 485.8199 b = 617.9725 p = 786.0732 i = 22 temp = 617.9725 b = 786.0732 p = 999.9005 i = 23 temp = 786.0732 b = 999.9005 p = 1.2719e+03 i = 24 temp = 999.9005 b = 1.2719e+03 p = 1.6179e+03 i = 25 temp = 1.2719e+03 b = 1.6179e+03 p = 2.0580e+03 i = 26 temp = 1.6179e+03 b = 2.0580e+03 p = 2.6178e+03 i = 27 temp = 2.0580e+03 b = 2.6178e+03 p = 3.3299e+03 i = 28 temp = 2.6178e+03 b = 3.3299e+03 p = 4.2356e+03 i = 29 temp = 3.3299e+03 b = 4.2356e+03 p = 5.3878e+03 i = 30 temp = 4.2356e+03 b = 5.3878e+03 p = 6.8534e+03 i = 31 temp = 5.3878e+03 b = 6.8534e+03 p = 8.7177e+03 i = 32 temp = 6.8534e+03 b = 8.7177e+03 p = 1.1089e+04 i = 33 temp = 8.7177e+03 b = 1.1089e+04 p = 1.4106e+04 i = 34 temp = 1.1089e+04 b = 1.4106e+04 p = 1.7942e+04 i = 35 temp = 1.4106e+04 b = 1.7942e+04 p = 2.2823e+04 i = 36 temp = 1.7942e+04 b = 2.2823e+04 p = 2.9032e+04 i = 37 temp = 2.2823e+04 b = 2.9032e+04 p = 3.6929e+04 i = 38 temp = 2.9032e+04 b = 3.6929e+04 p = 4.6974e+04 i = 39 temp = 3.6929e+04 b = 4.6974e+04 p = 5.9752e+04 i = 40 temp = 4.6974e+04 b = 5.9752e+04 p = 7.6006e+04 i = 41 temp = 5.9752e+04 b = 7.6006e+04 p = 9.6681e+04 i = 42 temp = 7.6006e+04 b = 9.6681e+04 p = 1.2298e+05 i = 43 temp = 9.6681e+04 b = 1.2298e+05 p = 1.5643e+05 i = 44 temp = 1.2298e+05 b = 1.5643e+05 p = 1.9899e+05 i = 45 temp = 1.5643e+05 b = 1.9899e+05 p = 2.5311e+05 i = 46 temp = 1.9899e+05 b = 2.5311e+05 p = 3.2196e+05 i = 47 temp = 2.5311e+05 b = 3.2196e+05 p = 4.0955e+05 i = 48 temp = 3.2196e+05 b = 4.0955e+05 p = 5.2095e+05 i = 49 ans = 4.3912e+11

Suggested Problems

More from this Author10

Community Treasure Hunt

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

Start Hunting!