Cody

# Problem 42405. Divisible by 3

Solution 1987649

Submitted on 23 Oct 2019 by Ngo Minh Ngoc
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
filetext = fileread('divisible_by_3.m'); assert(isempty(strfind(filetext, '*')),'* forbidden') assert(isempty(strfind(filetext, 'mtimes')),'mtimes() forbidden') assert(isempty(strfind(filetext, 'cross')),'cross() forbidden') assert(isempty(strfind(filetext, 'prod')),'prod() forbidden') assert(isempty(strfind(filetext, 'cumprod')),'cumprod() forbidden') assert(isempty(strfind(filetext, 'times')),'times() forbidden') assert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden') assert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden') assert(isempty(strfind(filetext, '/')),'/ forbidden') assert(isempty(strfind(filetext, '\')),'\ forbidden') assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'dot')),'dot() forbidden') assert(isempty(strfind(filetext, 'rem')),'rem() forbidden') assert(isempty(strfind(filetext, 'mod')),'mod() forbidden') assert(isempty(strfind(filetext, 'round')),'round() forbidden') assert(isempty(strfind(filetext, 'ceil')),'ceil() forbidden') assert(isempty(strfind(filetext, 'floor')),'floor() forbidden') assert(isempty(strfind(filetext, 'java')),'java forbidden')

2   Pass
n_str = '12'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 1 b = 3 y = logical 1

3   Pass
n_str = '13'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 1 b = 4 y = logical 0

4   Pass
n_str = '222'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 2 b = 4 b = 6 y = logical 1

5   Pass
n_str = '232'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 2 b = 5 b = 7 y = logical 0

6   Pass
n_str = '223'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 2 b = 4 b = 7 y = logical 0

7   Pass
n_str = '1236127'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 1 b = 3 b = 6 b = 12 b = 13 b = 15 b = 22 y = logical 0

8   Pass
n_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 1 b = 3 b = 6 b = 10 b = 15 b = 21 b = 28 b = 36 b = 45 b = 45 b = 46 b = 48 b = 51 b = 55 b = 60 b = 66 b = 73 b = 81 b = 90 b = 90 b = 91 b = 93 b = 96 b = 100 b = 105 b = 111 b = 118 b = 126 b = 135 b = 135 b = 136 b = 138 b = 141 b = 145 b = 150 b = 156 b = 163 b = 171 b = 180 b = 180 b = 181 b = 183 b = 186 b = 190 b = 195 b = 201 b = 208 b = 216 b = 225 b = 225 b = 226 b = 228 b = 231 b = 235 b = 240 b = 246 b = 253 b = 261 b = 270 b = 270 b = 271 b = 273 b = 276 b = 280 b = 285 b = 291 b = 298 b = 306 b = 315 b = 315 b = 316 b = 318 b = 321 b = 325 b = 330 b = 336 b = 343 b = 351 b = 360 b = 360 b = 361 b = 363 b = 366 b = 370 b = 375 b = 381 b = 388 b = 396 b = 405 b = 405 b = 406 b = 408 b = 411 b = 415 b = 420 b = 426 b = 433 b = 441 b = 450 b = 450 b = 451 b = 453 b = 456 b = 460 b = 465 b = 471 b = 478 b = 486 b = 495 b = 495 b = 496 b = 498 b = 501 b = 505 b = 510 b = 516 b = 523 b = 531 b = 540 b = 540 b = 541 b = 543 b = 546 b = 550 b = 555 b = 561 b = 568 b = 576 b = 585 b = 585 b = 586 b = 588 b = 591 b = 595 b = 600 b = 606 b = 613 b = 621 b = 630 b = 630 b = 631 b = 633 b = 636 b = 640 b = 645 b = 651 b = 658 b = 666 b = 675 b = 675 b = 676 b = 678 b = 681 b = 685 b = 690 b = 696 b = 703 b = 711 b = 720 b = 720 b = 721 b = 723 b = 726 b = 730 b = 735 b = 741 b = 748 b = 756 b = 765 b = 765 b = 766 b = 768 b = 771 b = 775 b = 780 b = 786 b = 793 b = 801 b = 810 b = 810 y = logical 1

9   Pass
n_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 1 b = 3 b = 6 b = 10 b = 15 b = 21 b = 28 b = 36 b = 45 b = 45 b = 46 b = 48 b = 51 b = 55 b = 60 b = 66 b = 73 b = 81 b = 90 b = 90 b = 91 b = 93 b = 96 b = 100 b = 105 b = 111 b = 118 b = 126 b = 135 b = 135 b = 136 b = 138 b = 141 b = 145 b = 150 b = 156 b = 163 b = 171 b = 180 b = 180 b = 181 b = 183 b = 186 b = 190 b = 195 b = 201 b = 208 b = 216 b = 225 b = 225 b = 226 b = 228 b = 231 b = 235 b = 240 b = 246 b = 253 b = 261 b = 270 b = 270 b = 271 b = 273 b = 276 b = 280 b = 285 b = 291 b = 298 b = 306 b = 315 b = 315 b = 316 b = 318 b = 321 b = 325 b = 330 b = 336 b = 343 b = 351 b = 360 b = 360 b = 361 b = 363 b = 366 b = 370 b = 375 b = 381 b = 388 b = 396 b = 405 b = 405 b = 406 b = 408 b = 411 b = 415 b = 420 b = 426 b = 433 b = 441 b = 450 b = 450 b = 451 b = 453 b = 456 b = 460 b = 465 b = 471 b = 478 b = 486 b = 495 b = 495 b = 496 b = 498 b = 501 b = 505 b = 510 b = 516 b = 523 b = 531 b = 540 b = 540 b = 541 b = 543 b = 546 b = 550 b = 555 b = 561 b = 568 b = 576 b = 585 b = 585 b = 586 b = 588 b = 591 b = 595 b = 600 b = 606 b = 613 b = 621 b = 630 b = 630 b = 631 b = 633 b = 636 b = 640 b = 645 b = 651 b = 658 b = 666 b = 675 b = 675 b = 676 b = 678 b = 681 b = 685 b = 690 b = 696 b = 703 b = 711 b = 720 b = 720 b = 721 b = 723 b = 726 b = 730 b = 735 b = 741 b = 748 b = 756 b = 765 b = 765 b = 766 b = 768 b = 771 b = 775 b = 780 b = 786 b = 793 b = 801 b = 810 b = 810 b = 811 y = logical 0

10   Pass
n_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 1 b = 3 b = 6 b = 12 b = 19 b = 27 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 y = logical 1

11   Pass
n_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'; assert(isequal(divisible_by_3(n_str),0))

b = 0 b = 1 b = 3 b = 6 b = 12 b = 19 b = 27 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 37 y = logical 0

12   Pass
n_str = '3141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420198938095257201065485863278865936153381827968230301952035301852968995773622599413891249721775283479131515574857242454150695950829533116861727855889075098381754637464939319255060400927701671139009848824012858361603563707660104710181942955596198946767837449448255379774726847104047534646208046684259069491293313677028989152104752162056966024058038150193511253382430035587640247496473263914199272604269922796'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 3 b = 4 b = 8 b = 9 b = 14 b = 23 b = 25 b = 31 b = 36 b = 39 b = 44 b = 52 b = 61 b = 68 b = 77 b = 80 b = 82 b = 85 b = 93 b = 97 b = 103 b = 105 b = 111 b = 115 b = 118 b = 121 b = 129 b = 132 b = 134 b = 141 b = 150 b = 155 b = 155 b = 157 b = 165 b = 173 b = 177 b = 178 b = 187 b = 194 b = 195 b = 201 b = 210 b = 213 b = 222 b = 231 b = 234 b = 241 b = 246 b = 247 b = 247 b = 252 b = 260 b = 262 b = 262 b = 271 b = 278 b = 282 b = 291 b = 295 b = 299 b = 304 b = 313 b = 315 b = 318 b = 318 b = 325 b = 333 b = 334 b = 340 b = 344 b = 344 b = 350 b = 352 b = 360 b = 366 b = 368 b = 368 b = 376 b = 385 b = 394 b = 402 b = 408 b = 410 b = 418 b = 418 b = 421 b = 425 b = 433 b = 435 b = 440 b = 443 b = 447 b = 449 b = 450 b = 451 b = 458 b = 458 b = 464 b = 471 b = 480 b = 488 b = 490 b = 491 b = 495 b = 503 b = 503 b = 511 b = 517 b = 522 b = 523 b = 526 b = 528 b = 536 b = 538 b = 541 b = 541 b = 547 b = 553 b = 557 b = 564 b = 564 b = 573 b = 576 b = 584 b = 588 b = 592 b = 598 b = 598 b = 607 b = 612 b = 617 b = 617 b = 622 b = 630 b = 632 b = 634 b = 637 b = 638 b = 645 b = 647 b = 652 b = 655 b = 660 b = 669 b = 673 b = 673 b = 681 b = 682 b = 684 b = 692 b = 696 b = 704 b = 705 b = 706 b = 707 b = 714 b = 718 b = 723 b = 723 b = 725 b = 733 b = 737 b = 738 b = 738 b = 740 b = 747 b = 747 b = 748 b = 757 b = 760 b = 768 b = 773 b = 775 b = 776 b = 777 b = 777 b = 782 b = 787 b = 792 b = 801 b = 807 b = 811 b = 815 b = 821 b = 823 b = 825 b = 834 b = 838 b = 846 b = 855 b = 860 b = 864 b = 873 b = 876 b = 876 b = 879 b = 887 b = 888 b = 897 b = 903 b = 907 b = 911 b = 913 b = 921 b = 929 b = 930 b = 930 b = 939 b = 946 b = 951 b = 957 b = 963 b = 968 b = 977 b = 980 b = 983 b = 987 b = 991 b = 997 b = 998 b = 1000 b = 1008 b = 1012 b = 1019 b = 1024 b = 1030 b = 1034 b = 1042 b = 1044 b = 1047 b = 1050 b = 1057 b = 1065 b = 1071 b = 1078 b = 1086 b = 1089 b = 1090 b = 1096 b = 1101 b = 1103 b = 1110 b = 1111 b = 1113 b = 1113 b = 1114 b = 1123 b = 1123 b = 1132 b = 1133 b = 1137 b = 1142 b = 1148 b = 1152 b = 1160 b = 1165 b = 1171 b = 1177 b = 1186 b = 1188 b = 1191 b = 1195 b = 1201 b = 1201 b = 1204 b = 1208 b = 1216 b = 1222 b = 1223 b = 1223 b = 1227 b = 1232 b = 1236 b = 1239 b = 1241 b = 1247 b = 1253 b = 1257 b = 1265 b = 1267 b = 1268 b = 1271 b = 1274 b = 1283 b = 1286 b = 1292 b = 1292 b = 1299 b = 1301 b = 1307 b = 1307 b = 1309 b = 1313 b = 1322 b = 1323 b = 1327 b = 1328 b = 1330 b = 1337 b = 1340 b = 1347 b = 1349 b = 1353 b = 1358 b = 1366 b = 1373 b = 1373 b = 1373 b = 1379 b = 1385 b = 1385 b = 1391 b = 1394 b = 1395 b = 1400 b = 1405 b = 1413 b = 1421 b = 1422 b = 1429 b = 1433 b = 1441 b = 1449 b = 1450 b = 1455 b = 1457 b = 1457 b = 1466 b = 1468 b = 1468 b = 1477 b = 1483 b = 1485 b = 1493 b = 1495 b = 1504 b = 1506 b = 1511 b = 1515 b = 1515 b = 1524 b = 1525 b = 1532 b = 1533 b = 1538 b = 1541 b = 1547 b = 1551 b = 1554 b = 1560 b = 1567 b = 1575 b = 1584 b = 1586 b = 1591 b = 1600 b = 1600 b = 1603 b = 1609 b = 1609 b = 1609 b = 1610 b = 1611 b = 1614 b = 1617 b = 1617 b = 1622 b = 1625 b = 1625 b = 1630 b = 1634 b = 1642 b = 1650 b = 1652 b = 1652 b = 1656 b = 1662 b = 1668 b = 1673 b = 1675 b = 1676 b = 1679 b = 1687 b = 1691 b = 1692 b = 1696 b = 1702 b = 1711 b = 1716 b = 1717 b = 1726 b = 1730 b = 1731 b = 1736 b = 1737 b = 1738 b = 1744 b = 1744 b = 1753 b = 1757 b = 1760 b = 1763 b = 1763 b = 1768 b = 1775 b = 1777 b = 1784 b = 1784 b = 1787 b = 1793 b = 1798 b = 1805 b = 1810 b = 1819 b = 1824 b = 1833 b = 1834 b = 1843 b = 1848 b = 1851 b = 1851 b = 1860 b = 1862 b = 1863 b = 1871 b = 1877 b = 1878 b = 1879 b = 1886 b = 1889 b = 1897 b = 1898 b = 1907 b = 1910 b = 1912 b = 1918 b = 1919 b = 1920 b = 1927 b = 1936 b = 1939 b = 1940 b = 1940 b = 1945 b = 1946 b = 1947 b = 1955 b = 1960 b = 1964 b = 1972 b = 1972 b = 1979 b = 1983 b = 1987 b = 1993 b = 1995 b = 1998 b = 2005 b = 2014 b = 2023 b = 2029 b = 2031 b = 2038 b = 2042 b = 2051 b = 2056 b = 2062 b = 2069 b = 2072 b = 2077 b = 2078 b = 2086 b = 2094 b = 2099 b = 2106 b = 2111 b = 2113 b = 2120 b = 2122 b = 2126 b = 2134 b = 2143 b = 2144 b = 2146 b = 2148 b = 2155 b = 2164 b = 2167 b = 2175 b = 2176 b = 2184 b = 2187 b = 2187 b = 2188 b = 2189 b = 2198 b = 2202 b = 2211 b = 2212 b = 2214 b = 2223 b = 2231 b = 2234 b = 2237 b = 2243 b = 2250 b = 2253 b = 2256 b = 2262 b = 2264 b = 2268 b = 2272 b = 2272 b = 2278 b = 2283 b = 2289 b = 2295 b = 2299 b = 2302 b = 2302 b = 2310 b = 2316 b = 2316 b = 2318 b = 2319 b = 2322 b = 2331 b = 2335 b = 2344 b = 2348 b = 2354 b = 2357 b = 2366 b = 2371 b = 2373 b = 2375 b = 2379 b = 2386 b = 2389 b = 2396 b = 2397 b = 2406 b = 2406 b = 2413 b = 2413 b = 2415 b = 2416 b = 2423 b = 2432 b = 2440 b = 2446 b = 2446 b = 2455 b = 2459 b = 2462 b = 2469 b = 2469 b = 2471 b = 2478 b = 2485 b = 2485 b = 2490 b = 2493 b = 2502 b = ...

13   Pass
n_str = '1010010101011010101001011010100101101010010100101101010011010100101'; assert(isequal(divisible_by_3(n_str),1))

b = 0 b = 1 b = 1 b = 2 b = 2 b = 2 b = 3 b = 3 b = 4 b = 4 b = 5 b = 5 b = 6 b = 7 b = 7 b = 8 b = 8 b = 9 b = 9 b = 10 b = 10 b = 10 b = 11 b = 11 b = 12 b = 13 b = 13 b = 14 b = 14 b = 15 b = 15 b = 15 b = 16 b = 16 b = 17 b = 18 b = 18 b = 19 b = 19 b = 20 b = 20 b = 20 b = 21 b = 21 b = 22 b = 22 b = 22 b = 23 b = 23 b = 24 b = 25 b = 25 b = 26 b = 26 b = 27 b = 27 b = 27 b = 28 b = 29 b = 29 b = 30 b = 30 b = 31 b = 31 b = 31 b = 32 b = 32 b = 33 y = logical 1

14   Pass
ind = randi(4); switch ind case 1 n_str = '12'; assert(isequal(divisible_by_3(n_str),1)) case 2 n_str = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901'; assert(isequal(divisible_by_3(n_str),0)) case 3 n_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; assert(isequal(divisible_by_3(n_str),1)) case 4 n_str = '1236127'; assert(isequal(divisible_by_3(n_str),0)) end

b = 0 b = 1 b = 3 y = logical 1

15   Pass
ind = randi(4); switch ind case 1 n_str = '1010010101011010101001011010100101101010010100101101010011010100101'; assert(isequal(divisible_by_3(n_str),1)) case 2 n_str = '12'; assert(isequal(divisible_by_3(n_str),1)) case 3 n_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'; assert(isequal(divisible_by_3(n_str),0)) case 4 n_str = '13'; assert(isequal(divisible_by_3(n_str),0)) end

b = 0 b = 1 b = 3 b = 6 b = 12 b = 19 b = 27 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 36 b = 37 y = logical 0

16   Pass
ind = randi(4); switch ind case 1 n_str = '13'; assert(isequal(divisible_by_3(n_str),0)) case 2 n_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'; assert(isequal(divisible_by_3(n_str),1)) case 3 n_str = '123678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'; assert(isequal(divisible_by_3(n_str),0)) case 4 n_str = '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; assert(isequal(divisible_by_3(n_str),1)) end

b = 0 b = 1 b = 3 b = 6 b = 10 b = 15 b = 21 b = 28 b = 36 b = 45 b = 45 b = 46 b = 48 b = 51 b = 55 b = 60 b = 66 b = 73 b = 81 b = 90 b = 90 b = 91 b = 93 b = 96 b = 100 b = 105 b = 111 b = 118 b = 126 b = 135 b = 135 b = 136 b = 138 b = 141 b = 145 b = 150 b = 156 b = 163 b = 171 b = 180 b = 180 b = 181 b = 183 b = 186 b = 190 b = 195 b = 201 b = 208 b = 216 b = 225 b = 225 b = 226 b = 228 b = 231 b = 235 b = 240 b = 246 b = 253 b = 261 b = 270 b = 270 b = 271 b = 273 b = 276 b = 280 b = 285 b = 291 b = 298 b = 306 b = 315 b = 315 b = 316 b = 318 b = 321 b = 325 b = 330 b = 336 b = 343 b = 351 b = 360 b = 360 b = 361 b = 363 b = 366 b = 370 b = 375 b = 381 b = 388 b = 396 b = 405 b = 405 b = 406 b = 408 b = 411 b = 415 b = 420 b = 426 b = 433 b = 441 b = 450 b = 450 b = 451 b = 453 b = 456 b = 460 b = 465 b = 471 b = 478 b = 486 b = 495 b = 495 b = 496 b = 498 b = 501 b = 505 b = 510 b = 516 b = 523 b = 531 b = 540 b = 540 b = 541 b = 543 b = 546 b = 550 b = 555 b = 561 b = 568 b = 576 b = 585 b = 585 b = 586 b = 588 b = 591 b = 595 b = 600 b = 606 b = 613 b = 621 b = 630 b = 630 b = 631 b = 633 b = 636 b = 640 b = 645 b = 651 b = 658 b = 666 b = 675 b = 675 b = 676 b = 678 b = 681 b = 685 b = 690 b = 696 b = 703 b = 711 b = 720 b = 720 b = 721 b = 723 b = 726 b = 730 b = 735 b = 741 b = 748 b = 756 b = 765 b = 765 b = 766 b = 768 b = 771 b = 775 b = 780 b = 786 b = 793 b = 801 b = 810 b = 810 y = logical 1

### Community Treasure Hunt

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

Start Hunting!