Cody

Problem 44732. Highly divisible triangular number (inspired by Project Euler 12)

Solution 3380823

Submitted on 25 Oct 2020
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
assessFunctionAbsence({'regexp', 'regexpi', 'str2num'},'FileName','div_tri_n.m')

2   Fail
assert(isequal(div_tri_n(2),6))

k = 1 3 y = 3

Assertion failed.

3   Fail
assert(isequal(div_tri_n(4),28))

k = 1 3 6 10 y = 6

Assertion failed.

4   Fail
assert(isequal(div_tri_n(8),36))

k = 1 3 6 10 15 21 28 36 y = 10

Assertion failed.

5   Fail
assert(isequal(div_tri_n(10),120))

k = 1 3 6 10 15 21 28 36 45 55 y = 15

Assertion failed.

6   Fail
assert(isequal(div_tri_n(20),630))

k = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 y = 21

Assertion failed.

7   Fail
assert(isequal(div_tri_n(25),2016))

k = 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 y = 28

Assertion failed.

8   Fail
assert(isequal(div_tri_n(39),3240))

k = Columns 1 through 29 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 Columns 30 through 39 465 496 528 561 595 630 666 703 741 780 y = 45

Assertion failed.

9   Fail
assert(isequal(div_tri_n(40),5460))

k = Columns 1 through 29 1 3 6 10 15 21 28 36 45 55 66 78 91 105 120 136 153 171 190 210 231 253 276 300 325 351 378 406 435 Columns 30 through 40 465 496 528 561 595 630 666 703 741 780 820 y = 45

Assertion failed.

10   Fail
assert(isequal(div_tri_n(50),25200))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 50 946 990 1035 1081 1128 1176 1225 1275 y = 55

Assertion failed.

11   Fail
assert(isequal(div_tri_n(70),25200))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 y = 78

Assertion failed.

12   Fail
assert(isequal(div_tri_n(80),25200))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 Columns 71 through 80 2556 2628 2701 2775 2850 2926 3003 3081 3160 3240 y = 91

Assertion failed.

13   Fail
assert(isequal(div_tri_n(100),73920))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 Columns 71 through 84 2556 2628 2701 2775 2850 2926 3003 3081 3160 3240 3321 3403 3486 3570 Columns 85 through 98 3655 3741 3828 3916 4005 4095 4186 4278 4371 4465 4560 4656 4753 4851 Columns 99 through 100 4950 5050 y = 105

Assertion failed.

14   Fail
assert(isequal(div_tri_n(115),157080))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 Columns 71 through 84 2556 2628 2701 2775 2850 2926 3003 3081 3160 3240 3321 3403 3486 3570 Columns 85 through 98 3655 3741 3828 3916 4005 4095 4186 4278 4371 4465 4560 4656 4753 4851 Columns 99 through 112 4950 5050 5151 5253 5356 5460 5565 5671 5778 5886 5995 6105 6216 6328 Columns 113 through 115 6441 6555 6670 y = 120

Assertion failed.

15   Fail
assert(isequal(div_tri_n(120),157080))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 Columns 71 through 84 2556 2628 2701 2775 2850 2926 3003 3081 3160 3240 3321 3403 3486 3570 Columns 85 through 98 3655 3741 3828 3916 4005 4095 4186 4278 4371 4465 4560 4656 4753 4851 Columns 99 through 112 4950 5050 5151 5253 5356 5460 5565 5671 5778 5886 5995 6105 6216 6328 Columns 113 through 120 6441 6555 6670 6786 6903 7021 7140 7260 y = 136

Assertion failed.

16   Fail
assert(isequal(div_tri_n(130),437580))

k = Columns 1 through 14 1 3 6 10 15 21 28 36 45 55 66 78 91 105 Columns 15 through 28 120 136 153 171 190 210 231 253 276 300 325 351 378 406 Columns 29 through 42 435 465 496 528 561 595 630 666 703 741 780 820 861 903 Columns 43 through 56 946 990 1035 1081 1128 1176 1225 1275 1326 1378 1431 1485 1540 1596 Columns 57 through 70 1653 1711 1770 1830 1891 1953 2016 2080 2145 2211 2278 2346 2415 2485 Columns 71 through 84 2556 2628 2701 2775 2850 2926 3003 3081 3160 3240 3321 3403 3486 3570 Columns 85 through 98 3655 3741 3828 3916 4005 4095 4186 4278 4371 4465 4560 4656 4753 4851 Columns 99 through 112 4950 5050 5151 5253 5356 5460 5565 5671 5778 5886 5995 6105 6216 6328 Columns 113 through 126 6441 6555 6670 6786 6903 7021 7140 7260 7381 7503 7626 7750 7875 8001 Columns 127 through 130 8128 8256 8385 8515 y = 136

Assertion failed.

Suggested Problems

More from this Author139

Community Treasure Hunt

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

Start Hunting!