Cody

# Problem 2024. Triangle sequence

Solution 673883

Submitted on 22 May 2015 by M_Morelock
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)

area = 25 area = 25 41

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

area = 25 area = 25 41 area = 25.0000 41.0000 66.0000

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

area = 25 area = 25 41 area = 25.0000 41.0000 66.0000 area = 25.0000 41.0000 66.0000 107.0000

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

area = 25 area = 25 41 area = 25.0000 41.0000 66.0000 area = 25.0000 41.0000 66.0000 107.0000 area = 25.0000 41.0000 66.0000 107.0000 173.0000 area = 25.0000 41.0000 66.0000 107.0000 173.0000 280.0000 area = 25.0000 41.0000 66.0000 107.0000 173.0000 280.0000 453.0000 area = 25.0000 41.0000 66.0000 107.0000 173.0000 280.0000 453.0000 733.0000 area = 1.0e+03 * 0.0250 0.0410 0.0660 0.1070 0.1730 0.2800 0.4530 0.7330 1.1860 area = 1.0e+03 * Columns 1 through 9 0.0250 0.0410 0.0660 0.1070 0.1730 0.2800 0.4530 0.7330 1.1860 Column 10 1.9190 area = 1.0e+03 * Columns 1 through 9 0.0250 0.0410 0.0660 0.1070 0.1730 0.2800 0.4530 0.7330 1.1860 Columns 10 through 11 1.9190 3.1050 area = 1.0e+03 * Columns 1 through 9 0.0250 0.0410 0.0660 0.1070 0.1730 0.2800 0.4530 0.7330 1.1860 Columns 10 through 12 1.9190 3.1050 5.0240 area = 1.0e+03 * Columns 1 through 9 0.0250 0.0410 0.0660 0.1070 0.1730 0.2800 0.4530 0.7330 1.1860 Columns 10 through 13 1.9190 3.1050 5.0240 8.1290 area = 1.0e+04 * Columns 1 through 9 0.0025 0.0041 0.0066 0.0107 0.0173 0.0280 0.0453 0.0733 0.1186 Columns 10 through 14 0.1919 0.3105 0.5024 0.8129 1.3153 area = 1.0e+04 * Columns 1 through 9 0.0025 0.0041 0.0066 0.0107 0.0173 0.0280 0.0453 0.0733 0.1186 Columns 10 through 15 0.1919 0.3105 0.5024 0.8129 1.3153 2.1282 area = 1.0e+04 * Columns 1 through 9 0.0025 0.0041 0.0066 0.0107 0.0173 0.0280 0.0453 0.0733 0.1186 Columns 10 through 16 0.1919 0.3105 0.5024 0.8129 1.3153 2.1282 3.4435 area = 1.0e+04 * Columns 1 through 9 0.0025 0.0041 0.0066 0.0107 0.0173 0.0280 0.0453 0.0733 0.1186 Columns 10 through 17 0.1919 0.3105 0.5024 0.8129 1.3153 2.1282 3.4435 5.5717 area = 1.0e+04 * Columns 1 through 9 0.0025 0.0041 0.0066 0.0107 0.0173 0.0280 0.0453 0.0733 0.1186 Columns 10 through 18 0.1919 0.3105 0.5024 0.8129 1.3153 2.1282 3.4435 5.5717 9.0152 area = 1.0e+05 * Columns 1 through 9 0.0003 0.0004 0.0007 0.0011 0.0017 0.0028 0.0045 0.0073 0.0119 Columns 10 through 18 0.0192 0.0310 0.0502 0.0813 0.1315 0.2128 0.3443 0.5572 0.9015 Column 19 1.4587 area = 1.0e+05 * Columns 1 through 9 0.0003 0.0004 0.0007 0.0011 0.0017 0.0028 0.0045 0.0073 0.0119 Columns 10 through 18 0.0192 0.0310 0.0502 0.0813 0.1315 0.2128 0.3443 0.5572 0.9015 Columns 19 through 20 1.4587 2.3602 area = 1.0e+05 * Columns 1 through 9 0.0003 0.0004 0.0007 0.0011 0.0017 0.0028 0.0045 0.0073 0.0119 Columns 10 through 18 0.0192 0.0310 0.0502 0.0813 0.1315 0.2128 0.3443 0.5572 0.9015 Columns 19 through 21 1.4587 2.3602 3.8189 area = 1.0e+05 * Columns 1 through 9 0.0003 0.0004 0.0007 0.0011 0.0017 0.0028 0.0045 0.0073 0.0119 Columns 10 through 18 0.0192 0.0310 0.0502 0.0813 0.1315 0.2128 0.3443 0.5572 0.9015 Columns 19 through 22 1.4587 2.3602 3.8189 6.1791 area = 1.0e+05 * Columns 1 through 9 0.0003 0.0004 0.0007 0.0011 0.0017 0.0028 0.0045 0.0073 0.0119 Columns 10 through 18 0.0192 0.0310 0.0502 0.0813 0.1315 0.2128 0.3443 0.5572 0.9015 Columns 19 through 23 1.4587 2.3602 3.8189 6.1791 9.9980 area = 1.0e+06 * Columns 1 through 9 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0007 0.0012 Columns 10 through 18 0.0019 0.0031 0.0050 0.0081 0.0132 0.0213 0.0344 0.0557 0.0902 Columns 19 through 24 0.1459 0.2360 0.3819 0.6179 0.9998 1.6177 area = 1.0e+06 * Columns 1 through 9 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0007 0.0012 Columns 10 through 18 0.0019 0.0031 0.0050 0.0081 0.0132 0.0213 0.0344 0.0557 0.0902 Columns 19 through 25 0.1459 0.2360 0.3819 0.6179 0.9998 1.6177 2.6175 area = 1.0e+06 * Columns 1 through 9 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0007 0.0012 Columns 10 through 18 0.0019 0.0031 0.0050 0.0081 0.0132 0.0213 0.0344 0.0557 0.0902 Columns 19 through 26 0.1459 0.2360 0.3819 0.6179 0.9998 1.6177 2.6175 4.2352 area = 1.0e+06 * Columns 1 through 9 0.0000 0.0000 0.0001 0.0001 0.0002 0.0003 0.0005 0.0007 0.0012 Columns 10 through 18 0.0019 0.0031 0.0050 0.0081 0.0132 0.0213 0.0344 0.0557 0.0902 Columns 19 through 27 0.1459 0.2360 0.3819 0.6179 0.9998 1.6177 2.6175 4.2352 6.8527 area = 1.0e+07 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 10 through 18 0.0002 0.0003 0.0005 0.0008 0.0013 0.0021 0.0034 0.0056 0.0090 Columns 19 through 27 0.0146 0.0236 0.0382 0.0618 0.1000 0.1618 0.2618 0.4235 0.6853 Column 28 1.1088 area = 1.0e+07 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 10 through 18 0.0002 0.0003 0.0005 0.0008 0.0013 0.0021 0.0034 0.0056 0.0090 Columns 19 through 27 0.0146 0.0236 0.0382 0.0618 0.1000 0.1618 0.2618 0.4235 0.6853 Columns 28 through 29 1.1088 1.7941 area = 1.0e+07 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 10 through 18 0.0002 0.0003 0.0005 0.0008 0.0013 0.0021 0.0034 0.0056 0.0090 Columns 19 through 27 0.0146 0.0236 0.0382 0.0618 0.1000 0.1618 0.2618 0.4235 0.6853 Columns 28 through 30 1.1088 1.7941 2.9029 area = 1.0e+07 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 10 through 18 0.0002 0.0003 0.0005 0.0008 0.0013 0.0021 0.0034 0.0056 0.0090 Columns 19 through 27 0.0146 0.0236 0.0382 0.0618 0.1000 0.1618 0.2618 0.4235 0.6853 Columns 28 through 31 1.1088 1.7941 2.9029 4.6969 area = 1.0e+07 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 10 through 18 0.0002 0.0003 0.0005 0.0008 0.0013 0.0021 0.0034 0.0056 0.0090 Columns 19 through 27 0.0146 0.0236 0.0382 0.0618 0.1000 0.1618 0.2618 0.4235 0.6853 Columns 28 through 32 1.1088 1.7941 2.9029 4.6969 7.5998 area = 1.0e+08 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0006 0.0009 Columns 19 through 27 0.0015 0.0024 0.0038 0.0062 0.0100 0.0162 0.0262 0.0424 0.0685 Columns 28 through 33 0.1109 0.1794 0.2903 0.4697 0.7600 1.2297 area = 1.0e+08 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0006 0.0009 Columns 19 through 27 0.0015 0.0024 0.0038 0.0062 0.0100 0.0162 0.0262 0.0424 0.0685 Columns 28 through 34 0.1109 0.1794 0.2903 0.4697 0.7600 1.2297 1.9897 area = 1.0e+08 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0006 0.0009 Columns 19 through 27 0.0015 0.0024 0.0038 0.0062 0.0100 0.0162 0.0262 0.0424 0.0685 Columns 28 through 35 0.1109 0.1794 0.2903 0.4697 0.7600 1.2297 1.9897 3.2193 area = 1.0e+08 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0006 0.0009 Columns 19 through 27 0.0015 0.0024 0.0038 0.0062 0.0100 0.0162 0.0262 0.0424 0.0685 Columns 28 through 36 0.1109 0.1794 0.2903 0.4697 0.7600 1.2297 1.9897 3.2193 5.2090 area = 1.0e+08 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0001 0.0001 0.0001 0.0002 0.0003 0.0006 0.0009 Columns 19 through 27 0.0015 0.0024 0.0038 0.0062 0.0100 0.0162 0.0262 0.0424 0.0685 Columns 28 through 36 0.1109 0.1794 0.2903 0.4697 0.7600 1.2297 1.9897 3.2193 5.2090 Column 37 8.4283 area = 1.0e+09 * Columns 1 through 9 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 Columns 10 through 18 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0001 0.0001 Columns 19 through 27 0.0001 0.00...