Cody

Problem 2024. Triangle sequence

Solution 1567947

Submitted on 23 Jun 2018 by Radha Kumari
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)

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

T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031

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

T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 0.3717 0.0779 0.6561 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240

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

T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 0.9731 0.2913 0.7466 0.7321 0.8207 0.3403 0.7230 0.8542 0.0150 0.9558 0.3878 0.2142 0.0532 0.8397 0.9826 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 0.7321 0.8207 0.3403 0.7230 0.8542 0.0150 0.9558 0.3878 0.2142 0.0532 0.8397 0.9826 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 6.4031 8.1240 10.3441 0.7230 0.8542 0.0150 0.9558 0.3878 0.2142 0.0532 0.8397 0.9826 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 6.4031 8.1240 10.3441 8.1240 10.3441 13.1529 0.9558 0.3878 0.2142 0.0532 0.8397 0.9826 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 6.4031 8.1240 10.3441 8.1240 10.3441 13.1529 10.3441 13.1529 16.7332 0.0532 0.8397 0.9826 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 6.4031 8.1240 10.3441 8.1240 10.3441 13.1529 10.3441 13.1529 16.7332 13.1529 16.7332 21.2838 0.3161 0.1277 0.5798 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 0.7565 0.2875 0.1155 0.3810 0.3278 0.0445 0.3576 0.2774 0.2272 0.0854 0.8535 0.2049 0.0423 0.0861 0.0723 0.8983 0.5871 0.5798 0.8195 0.0234 0.5133 0.6865 0.5816 0.6584 0.1818 0.1849 0.3565 0.8020 0.4288 0.9555 0.9576 0.3872 0.2482 0.1658 0.2386 0.0744 0.3392 0.5282 0.6837 0.0535 0.8054 0.6259 0.8110 0.2891 0.6318 0.6443 0.7798 0.2029 0.2744 0.8484 0.8069 0.1912 0.0811 0.6565 0.9390 0.8759 0.1505 0.2302 0.7781 0.6356 0.2691 0.0616 0.2512 0.0186 0.8739 0.5102 0.5327 0.7568 0.3869 0.3645 0.5355 0.5530 0.4982 0.6971 0.7254 0.2459 0.3181 0.8721 0.7990 0.4509 0.8943 0.6873 0.8745 0.0222 0.9064 0.9769 0.6972 T = 3.0000 4.0000 5.0000 4.0000 5.0000 6.4031 5.0000 6.4031 8.1240 6.4031 8.1240 10.3441 8.1240 10.3441 13.1529 10.3441 13.1529 16.7332 13.1529 16.7332 21.2838 16.7332 21.2838 27.0740 0.7796 0.8002 0.8379 0.9706 0.2117 0.4697 0.8561 0.2591 0.8723 0.0835 0.0910 0.7906 0.8354 0.9708 0.8034 0.7865 0.7992 0.7726 0.2953 0.5938 0.4643 0.8933 0.7236 0.2303 0.9263 0.4750 0.2884 0.7005 0.3541 0.7840 0.4496 0.8066 0.2252 0.5548 0.3132 0.0730 0.7065 0.1093 0.6959 ...

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!