Cody

# Problem 2024. Triangle sequence

Solution 1591512

Submitted on 25 Jul 2018 by HOng
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)

input = 3 4 output = 4 5 25 n = 2 input = 4 5 25

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

input = 3 4 output = 4 5 25 n = 2 input = 4 5 25 output = 5.0000 6.4031 41.0000 n = 3 input = 5.0000 6.4031 41.0000

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

input = 3 4 output = 4 5 25 n = 2 input = 4 5 25 output = 5.0000 6.4031 41.0000 n = 3 input = 5.0000 6.4031 41.0000 output = 6.4031 8.1240 66.0000 n = 4 input = 6.4031 8.1240 66.0000

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

input = 3 4 output = 4 5 25 n = 2 input = 4 5 25 output = 5.0000 6.4031 41.0000 n = 3 input = 5.0000 6.4031 41.0000 output = 6.4031 8.1240 66.0000 n = 4 input = 6.4031 8.1240 66.0000 output = 8.1240 10.3441 107.0000 n = 5 input = 8.1240 10.3441 107.0000 output = 10.3441 13.1529 173.0000 n = 6 input = 10.3441 13.1529 173.0000 output = 13.1529 16.7332 280.0000 n = 7 input = 13.1529 16.7332 280.0000 output = 16.7332 21.2838 453.0000 n = 8 input = 16.7332 21.2838 453.0000 output = 21.2838 27.0740 733.0000 n = 9 input = 21.2838 27.0740 733.0000 output = 1.0e+03 * 0.0271 0.0344 1.1860 n = 10 input = 1.0e+03 * 0.0271 0.0344 1.1860 output = 1.0e+03 * 0.0344 0.0438 1.9190 n = 11 input = 1.0e+03 * 0.0344 0.0438 1.9190 output = 1.0e+03 * 0.0438 0.0557 3.1050 n = 12 input = 1.0e+03 * 0.0438 0.0557 3.1050 output = 1.0e+03 * 0.0557 0.0709 5.0240 n = 13 input = 1.0e+03 * 0.0557 0.0709 5.0240 output = 1.0e+03 * 0.0709 0.0902 8.1290 n = 14 input = 1.0e+03 * 0.0709 0.0902 8.1290 output = 1.0e+04 * 0.0090 0.0115 1.3153 n = 15 input = 1.0e+04 * 0.0090 0.0115 1.3153 output = 1.0e+04 * 0.0115 0.0146 2.1282 n = 16 input = 1.0e+04 * 0.0115 0.0146 2.1282 output = 1.0e+04 * 0.0146 0.0186 3.4435 n = 17 input = 1.0e+04 * 0.0146 0.0186 3.4435 output = 1.0e+04 * 0.0186 0.0236 5.5717 n = 18 input = 1.0e+04 * 0.0186 0.0236 5.5717 output = 1.0e+04 * 0.0236 0.0300 9.0152 n = 19 input = 1.0e+04 * 0.0236 0.0300 9.0152 output = 1.0e+05 * 0.0030 0.0038 1.4587 n = 20 input = 1.0e+05 * 0.0030 0.0038 1.4587 output = 1.0e+05 * 0.0038 0.0049 2.3602 n = 21 input = 1.0e+05 * 0.0038 0.0049 2.3602 output = 1.0e+05 * 0.0049 0.0062 3.8189 n = 22 input = 1.0e+05 * 0.0049 0.0062 3.8189 output = 1.0e+05 * 0.0062 0.0079 6.1791 n = 23 input = 1.0e+05 * 0.0062 0.0079 6.1791 output = 1.0e+05 * 0.0079 0.0100 9.9980 n = 24 input = 1.0e+05 * 0.0079 0.0100 9.9980 output = 1.0e+06 * 0.0010 0.0013 1.6177 n = 25 input = 1.0e+06 * 0.0010 0.0013 1.6177 output = 1.0e+06 * 0.0013 0.0016 2.6175 n = 26 input = 1.0e+06 * 0.0013 0.0016 2.6175 output = 1.0e+06 * 0.0016 0.0021 4.2352 n = 27 input = 1.0e+06 * 0.0016 0.0021 4.2352 output = 1.0e+06 * 0.0021 0.0026 6.8527 n = 28 input = 1.0e+06 * 0.0021 0.0026 6.8527 output = 1.0e+07 * 0.0003 0.0003 1.1088 n = 29 input = 1.0e+07 * 0.0003 0.0003 1.1088 output = 1.0e+07 * 0.0003 0.0004 1.7941 n = 30 input = 1.0e+07 * 0.0003 0.0004 1.7941 output = 1.0e+07 * 0.0004 0.0005 2.9029 n = 31 input = 1.0e+07 * 0.0004 0.0005 2.9029 output = 1.0e+07 * 0.0005 0.0007 4.6969 n = 32 input = 1.0e+07 * 0.0005 0.0007 4.6969 output = 1.0e+07 * 0.0007 0.0009 7.5998 n = 33 input = 1.0e+07 * 0.0007 0.0009 7.5998 output = 1.0e+08 * 0.0001 0.0001 1.2297 n = 34 input = 1.0e+08 * 0.0001 0.0001 1.2297 output = 1.0e+08 * 0.0001 0.0001 1.9897 n = 35 input = 1.0e+08 * 0.0001 0.0001 1.9897 output = 1.0e+08 * 0.0001 0.0002 3.2193 n = 36 input = 1.0e+08 * 0.0001 0.0002 3.2193 output = 1.0e+08 * 0.0002 0.0002 5.2090 n = 37 input = 1.0e+08 * 0.0002 0.0002 5.2090 output = 1.0e+08 * 0.0002 0.0003 8.4283 n = 38 input = 1.0e+08 * 0.0002 0.0003 8.4283 output = 1.0e+09 * 0.0000 0.0000 1.3637 n = 39 input = 1.0e+09 * 0.0000 0.0000 1.3637 output = 1.0e+09 * 0.0000 0.0000 2.2066 n = 40 input = 1.0e+09 * 0.0000 0.0000 2.2066 output = 1.0e+09 * 0.0000 0.0001 3.5703 n = 41 input = 1.0e+09 * 0.0000 0.0001 3.5703 output = 1.0e+09 * 0.0001 0.0001 5.7769 n = 42 input = 1.0e+09 * 0.0001 0.0001 5.7769 output = 1.0e+09 * 0.0001 0.0001 9.3471 n = 43 input = 1.0e+09 * 0.0001 0.0001 9.3471 output = 1.0e+10 * 0.0000 0.0000 1.5124 n = 44 input = 1.0e+10 * 0.0000 0.0000 1.5124 output = 1.0e+10 * 0.0000 0.0000 2.4471 n = 45 input = 1.0e+10 * 0.0000 0.0000 2.4471 output = 1.0e+10 * 0.0000 0.0000 3.9595 n = 46 input = 1.0e+10 * 0.0000 0.0000 3.9595 output = 1.0e+10 * 0.0000 0.0000 6.4066 n = 47 input = 1.0e+10 * 0.0000 0.0000 6.4066 output = 1.0e+11 * 0.0000 0.0000 1.0366 n = 48 input = 1.0e+11 * 0.0000 0.0000 1.0366 output = 1.0e+11 * 0.0000 0.0000 1.6773 n = 49 input = 1.0e+11 * 0.0000 0.0000 1.6773 output = 1.0e+11 * 0.0000 0.0000 2.7139 n = 50 input = 1.0e+11 * 0.0000 0.0000 2.7139 output = 1.0e+11 * 0.0000 0.0000 4.3912 n = 51 input = 1.0e+11 * 0.0000 0.0000 4.3912