Cody

# Problem 2024. Triangle sequence

Solution 2011246

Submitted on 9 Nov 2019 by Jimmy Jing
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)

seq = 3 4 5 area = 25

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

seq = 3 4 5 seq = 3.0000 4.0000 5.0000 6.4031 area = 41

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

seq = 3 4 5 seq = 3.0000 4.0000 5.0000 6.4031 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 area = 66.0000

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

seq = 3 4 5 seq = 3.0000 4.0000 5.0000 6.4031 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 seq = 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Column 19 236.0445 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 20 236.0445 300.2532 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 21 236.0445 300.2532 381.9280 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 22 236.0445 300.2532 381.9280 485.8199 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 23 236.0445 300.2532 381.9280 485.8199 617.9725 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 24 236.0445 300.2532 381.9280 485.8199 617.9725 786.0732 seq = Columns 1 through 18 3.0000 4.0000 5.0000 6.4031 8.1240 10.3441 13.1529 16.7332 21.2838 27.0740 34.4384 43.8064 55.7225 70.8802 90.1610 114.6865 145.8835 185.5667 Columns 19 through 25 236.0445 300.2532 381.9280 485.8199 617.9725 786.0732 999.9005 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 26 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 27 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 28 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 29 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 30 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 3.3299 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 31 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 3.3299 4.2356 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 32 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 3.3299 4.2356 5.3878 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 33 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 3.3299 4.2356 5.3878 6.8534 seq = 1.0e+03 * Columns 1 through 18 0.0030 0.0040 0.0050 0.0064 0.0081 0.0103 0.0132 0.0167 0.0213 0.0271 0.0344 0.0438 0.0557 0.0709 0.0902 0.1147 0.1459 0.1856 Columns 19 through 34 0.2360 0.3003 0.3819 0.4858 0.6180 0.7861 0.9999 1.2719 1.6179 2.0580 2.6178 3.3299 4.2356 5.3878 6.8534 8.7177 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 35 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 36 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 1.4106 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 36 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 1.4106 Column 37 1.7942 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 36 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 1.4106 Columns 37 through 38 1.7942 2.2823 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 36 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 1.4106 Columns 37 through 39 1.7942 2.2823 2.9032 seq = 1.0e+04 * Columns 1 through 18 0.0003 0.0004 0.0005 0.0006 0.0008 0.0010 0.0013 0.0017 0.0021 0.0027 0.0034 0.0044 0.0056 0.0071 0.0090 0.0115 0.0146 0.0186 Columns 19 through 36 0.0236 0.0300 0.0382 0.0486 0.0618 0.0786 0.1000 0.1272 0.1618 0.2058 0.2618 0.3330 0.4236 0.5388 0.6853 0.8718 1.1089 1.4106 Columns 37 through 40 1.7942 2.2823 2.9032 3.6929 seq = 1.0e+04 * Columns 1 through 18 ...