Cody

# Problem 42405. Divisible by 3

Solution 1987638

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))

a = 0 b = 1 a = 1 b = 2 a = 3 c = 3 d = logical 1 y = 1

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

a = 0 b = 1 a = 1 b = 3 a = 4 c = 2 2 d = logical 0 y = 0

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

a = 0 b = 2 a = 2 b = 2 a = 4 b = 2 a = 6 c = 2 3 d = logical 1 y = 1

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

a = 0 b = 2 a = 2 b = 3 a = 5 b = 2 a = 7 c = 7 d = logical 0 y = 0

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

a = 0 b = 2 a = 2 b = 2 a = 4 b = 3 a = 7 c = 7 d = logical 0 y = 0

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

a = 0 b = 1 a = 1 b = 2 a = 3 b = 3 a = 6 b = 6 a = 12 b = 1 a = 13 b = 2 a = 15 b = 7 a = 22 c = 2 11 d = logical 0 y = 0

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

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

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

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

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

a = 0 b = 1 a = 1 b = 2 a = 3 b = 3 a = 6 b = 6 a = 12 b = 7 a = 19 b = 8 a = 27 b = 9 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 c = 2 2 3 3 d = logical 1 y = 1

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

a = 0 b = 1 a = 1 b = 2 a = 3 b = 3 a = 6 b = 6 a = 12 b = 7 a = 19 b = 8 a = 27 b = 9 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 1 a = 37 c = 37 d = logical 0 y = 0

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

a = 0 b = 3 a = 3 b = 1 a = 4 b = 4 a = 8 b = 1 a = 9 b = 5 a = 14 b = 9 a = 23 b = 2 a = 25 b = 6 a = 31 b = 5 a = 36 b = 3 a = 39 b = 5 a = 44 b = 8 a = 52 b = 9 a = 61 b = 7 a = 68 b = 9 a = 77 b = 3 a = 80 b = 2 a = 82 b = 3 a = 85 b = 8 a = 93 b = 4 a = 97 b = 6 a = 103 b = 2 a = 105 b = 6 a = 111 b = 4 a = 115 b = 3 a = 118 b = 3 a = 121 b = 8 a = 129 b = 3 a = 132 b = 2 a = 134 b = 7 a = 141 b = 9 a = 150 b = 5 a = 155 b = 0 a = 155 b = 2 a = 157 b = 8 a = 165 b = 8 a = 173 b = 4 a = 177 b = 1 a = 178 b = 9 a = 187 b = 7 a = 194 b = 1 a = 195 b = 6 a = 201 b = 9 a = 210 b = 3 a = 213 b = 9 a = 222 b = 9 a = 231 b = 3 a = 234 b = 7 a = 241 b = 5 a = 246 b = 1 a = 247 b = 0 a = 247 b = 5 a = 252 b = 8 a = 260 b = 2 a = 262 b = 0 a = 262 b = 9 a = 271 b = 7 a = 278 b = 4 a = 282 b = 9 a = 291 b = 4 a = 295 b = 4 a = 299 b = 5 a = 304 b = 9 a = 313 b = 2 a = 315 b = 3 a = 318 b = 0 a = 318 b = 7 a = 325 b = 8 a = 333 b = 1 a = 334 b = 6 a = 340 b = 4 a = 344 b = 0 a = 344 b = 6 a = 350 b = 2 a = 352 b = 8 a = 360 b = 6 a = 366 b = 2 a = 368 b = 0 a = 368 b = 8 a = 376 b = 9 a = 385 b = 9 a = 394 b = 8 a = 402 b = 6 a = 408 b = 2 a = 410 b = 8 a = 418 b = 0 a = 418 b = 3 a = 421 b = 4 a = 425 b = 8 a = 433 b = 2 a = 435 b = 5 a = 440 b = 3 a = 443 b = 4 a = 447 b = 2 a = 449 b = 1 a = 450 b = 1 a = 451 b = 7 a = 458 b = 0 a = 458 b = 6 a = 464 b = 7 a = 471 b = 9 a = 480 b = 8 a = 488 b = 2 a = 490 b = 1 a = 491 b = 4 a = 495 b = 8 a = 503 b = 0 a = 503 b = 8 a = 511 b = 6 a = 517 b = 5 a = 522 b = 1 a = 523 b = 3 a = 526 b = 2 a = 528 b = 8 a = 536 b = 2 a = 538 b = 3 a = 541 b = 0 a = 541 b = 6 a = 547 b = 6 a = 553 b = 4 a = 557 b = 7 a = 564 b = 0 a = 564 b = 9 a = 573 b = 3 a = 576 b = 8 a = 584 b = 4 a = 588 b = 4 a = 592 b = 6 a = 598 b = 0 a = 598 b = 9 a = 607 b = 5 a = 612 b = 5 a = 617 b = 0 a = 617 b = 5 a = 622 b = 8 a = 630 b = 2 a = 632 b = 2 a = 634 b = 3 a = 637 b = 1 a = 638 b = 7 a = 645 b = 2 a = 647 b = 5 a = 652 b = 3 a = 655 b = 5 a = 660 b = 9 a = 669 b = 4 a = 673 b = 0 a = 673 b = 8 a = 681 b = 1 a = 682 b = 2 a = 684 b = 8 a = 692 b = 4 a = 696 b = 8 a = 704 b = 1 a = 705 b = 1 a = 706 b = 1 a = 707 b = 7 a = 714 b = 4 a = 718 b = 5 a = 723 b = 0 a = 723 b = 2 a = 725 b = 8 a = 733 b = 4 a = 737 b = 1 a = 738 b = 0 a = 738 b = 2 a = 740 b = 7 a = 747 b = 0 a = 747 b = 1 a = 748 b = 9 a = 757 b = 3 a = 760 b = 8 a = 768 b = 5 a = 773 b = 2 a = 775 b = 1 a = 776 b = 1 a = 777 b = 0 a = 777 b = 5 a = 782 b = 5 a = 787 b = 5 a = 792 b = 9 a = 801 b = 6 a = 807 b = 4 a = 811 b = 4 a = 815 b = 6 a = 821 b = 2 a = 823 b = 2 a = 825 b = 9 a = 834 b = 4 a = 838 b = 8 a = 846 b = 9 a = 855 b = 5 a = 860 b = 4 a = 864 b = 9 a = 873 b = 3 a = 876 b = 0 a = 876 b = 3 a = 879 b = 8 a = 887 b = 1 a = 888 b = 9 a = 897 b = 6 a = 903 b = 4 a = 907 b = 4 a = 911 b = 2 a = 913 b = 8 a = 921 b = 8 a = 929 b = 1 a = 930 b = 0 a = 930 b = 9 a = 939 b = 7 a = 946 b = 5 a = 951 b = 6 a = 957 b = 6 a = 963 b = 5 a = 968 b = 9 a = 977 b = 3 a = 980 b = 3 a = 983 b = 4 a = 987 b = 4 a = 991 b = 6 a = 997 b = 1 a = 998 b = 2 a = 1000 b = 8 a = 1008 b = 4 a = 1012 b = 7 a = 1019 b = 5 a = 1024 b = 6 a = 1030 b = 4 a = 1034 b = 8 a = 1042 b = 2 a = 1044 b = 3 a = 1047 b = 3 a = 1050 b = 7 a = 1057 b = 8 a = 1065 b = 6 a = 1071 b = 7 a = 1078 b = 8 a = 1086 b = 3 a = 1089 b = 1 a = 1090 b = 6 a = 1096 b = 5 a = 1101 b = 2 a = 1103 b = 7 a = 1110 b = 1 a = 1111 b = 2 a = 1113 b = 0 a = 1113 b = 1 a = 1114 b = 9 a = 1123 b = 0 a = 1123 b = 9 a = 1132 b = 1 a = 1133 b = 4 a = 1137 b = 5 a = 1142 b = 6 a = 1148 b = 4 a = 1152 b = 8 a = 1160 b = 5 a = 1165 b = 6 a = 1171 b = 6 a = 1177 b = 9 a = 1186 b = 2 a = 1188 b = 3 a = 1191 b = 4 a = 1195 b = 6 a = 1201 b = 0 a = 1201 b = 3 a = 1204 b = 4 a = 1208 b = 8 a = 1216 b = 6 a = 1222 b = 1 a = 1223 b = 0 a = 1223 b = 4 a = 1227 b = 5 a = 1232 b = 4 a = 1236 b = 3 a = 1239 b = 2 a = 1241 b = 6 a = 1247 b = 6 a = 1253 b = 4 a = 1257 b = 8 a = 1265 b = 2 a = 1267 b = 1 a = 1268 b = 3 a = 1271 b = 3 a = 1274 b = 9 a = 1283 b = 3 a = 1286 b = 6 a = 1292 b = 0 a = 1292 b = 7 a = 1299 b = 2 a = 1301 b = 6 a = 1307 b = 0 a = 1307 b = 2 a = 1309 b = 4 a = 1313 b = 9 a = 1322 b = 1 a = 1323 b = 4 a = 1327 b = 1 a = 1328 b = 2 a = 1330 b = 7 a = 1337 b = 3 a = 1340 b = 7 a = 1347 b = 2 a = 1349 b = 4 a = 1353 b = 5 a = 1358 b = 8 a = 1366 b = 7 a = 1373 b = 0 a = 1373 b = 0 a = 1373 b = 6 a = 1379 b = 6 a = 1385 b = 0 a = 1385 b = 6 a = 1391 b = 3 a = 1394 b = 1 a = 1395 b = 5 a = 1400 b = 5 a = 1405 b = 8 a = 1413 b = 8 a = 1421 b = 1 a = 1422 b = 7 a = 1429 b = 4 a = 1433 b = 8 a = 1441 b = 8 a = 1449 b = 1 a = 1450 b = 5 a = 1455 b = 2 a = 1457 b = 0 a = 1457 b = 9 a = 1466 b = 2 a = 1468 b = 0 a = 1468 b = 9 a = 1477 b = 6 a = ...

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

a = 0 b = 1 a = 1 b = 0 a = 1 b = 1 a = 2 b = 0 a = 2 b = 0 a = 2 b = 1 a = 3 b = 0 a = 3 b = 1 a = 4 b = 0 a = 4 b = 1 a = 5 b = 0 a = 5 b = 1 a = 6 b = 1 a = 7 b = 0 a = 7 b = 1 a = 8 b = 0 a = 8 b = 1 a = 9 b = 0 a = 9 b = 1 a = 10 b = 0 a = 10 b = 0 a = 10 b = 1 a = 11 b = 0 a = 11 b = 1 a = 12 b = 1 a = 13 b = 0 a = 13 b = 1 a = 14 b = 0 a = 14 b = 1 a = 15 b = 0 a = 15 b = 0 a = 15 b = 1 a = 16 b = 0 a = 16 b = 1 a = 17 b = 1 a = 18 b = 0 a = 18 b = 1 a = 19 b = 0 a = 19 b = 1 a = 20 b = 0 a = 20 b = 0 a = 20 b = 1 a = 21 b = 0 a = 21 b = 1 a = 22 b = 0 a = 22 b = 0 a = 22 b = 1 a = 23 b = 0 a = 23 b = 1 a = 24 b = 1 a = 25 b = 0 a = 25 b = 1 a = 26 b = 0 a = 26 b = 1 a = 27 b = 0 a = 27 b = 0 a = 27 b = 1 a = 28 b = 1 a = 29 b = 0 a = 29 b = 1 a = 30 b = 0 a = 30 b = 1 a = 31 b = 0 a = 31 b = 0 a = 31 b = 1 a = 32 b = 0 a = 32 b = 1 a = 33 c = 3 11 d = logical 1 y = 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

a = 0 b = 1 a = 1 b = 2 a = 3 b = 3 a = 6 b = 6 a = 12 b = 1 a = 13 b = 2 a = 15 b = 7 a = 22 c = 2 11 d = logical 0 y = 0

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

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

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

a = 0 b = 1 a = 1 b = 2 a = 3 b = 3 a = 6 b = 6 a = 12 b = 7 a = 19 b = 8 a = 27 b = 9 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 0 a = 36 b = 1 a = 37 c = 37 d = logical 0 y = 0

### Community Treasure Hunt

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

Start Hunting!