Cody

Solution 1695479

Submitted on 18 Dec 2018 by Martin C.
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','FileName','digit_sum.m')

2   Pass
x = '123456789'; assert(isequal(digit_sum(x),9))

temp = 0 temp = 1 temp = 3 temp = 6 temp = 10 temp = 15 temp = 21 temp = 28 temp = 36 temp = 45 a = '45' temp = 0 temp = 4 temp = 9 a = '9' s = 9

3   Pass
x = '13579'; assert(isequal(digit_sum(x),7))

temp = 0 temp = 1 temp = 4 temp = 9 temp = 16 temp = 25 a = '25' temp = 0 temp = 2 temp = 7 a = '7' s = 7

4   Pass
x = '199'; assert(isequal(digit_sum(x),1))

temp = 0 temp = 1 temp = 10 temp = 19 a = '19' temp = 0 temp = 1 temp = 10 a = '10' temp = 0 temp = 1 temp = 1 a = '1' s = 1

5   Pass
x = '19999999999999999999999'; assert(isequal(digit_sum(x),1))

temp = 0 temp = 1 temp = 10 temp = 19 temp = 28 temp = 37 temp = 46 temp = 55 temp = 64 temp = 73 temp = 82 temp = 91 temp = 100 temp = 109 temp = 118 temp = 127 temp = 136 temp = 145 temp = 154 temp = 163 temp = 172 temp = 181 temp = 190 temp = 199 a = '199' temp = 0 temp = 1 temp = 10 temp = 19 a = '19' temp = 0 temp = 1 temp = 10 a = '10' temp = 0 temp = 1 temp = 1 a = '1' s = 1

6   Pass
x = '1036654257757615301164620529930689045676735109259113932133140605724504628985272966102896725849035075'; assert(isequal(digit_sum(x),5))

temp = 0 temp = 1 temp = 1 temp = 4 temp = 10 temp = 16 temp = 21 temp = 25 temp = 27 temp = 32 temp = 39 temp = 46 temp = 51 temp = 58 temp = 64 temp = 65 temp = 70 temp = 73 temp = 73 temp = 74 temp = 75 temp = 81 temp = 85 temp = 91 temp = 93 temp = 93 temp = 98 temp = 100 temp = 109 temp = 118 temp = 121 temp = 121 temp = 127 temp = 135 temp = 144 temp = 144 temp = 148 temp = 153 temp = 159 temp = 166 temp = 172 temp = 179 temp = 182 temp = 187 temp = 188 temp = 188 temp = 197 temp = 199 temp = 204 temp = 213 temp = 214 temp = 215 temp = 218 temp = 227 temp = 230 temp = 232 temp = 233 temp = 236 temp = 239 temp = 240 temp = 244 temp = 244 temp = 250 temp = 250 temp = 255 temp = 262 temp = 264 temp = 268 temp = 273 temp = 273 temp = 277 temp = 283 temp = 285 temp = 293 temp = 302 temp = 310 temp = 315 temp = 317 temp = 324 temp = 326 temp = 335 temp = 341 temp = 347 temp = 348 temp = 348 temp = 350 temp = 358 temp = 367 temp = 373 temp = 380 temp = 382 temp = 387 temp = 395 temp = 399 temp = 408 temp = 408 temp = 411 temp = 416 temp = 416 temp = 423 temp = 428 a = '428' temp = 0 temp = 4 temp = 6 temp = 14 a = '14' temp = 0 temp = 1 temp = 5 a = '5' s = 5

7   Pass
x = '74021245485969262660226837606390444737401741361729271205654666692721644673648826558231964656575921104437679911605584367531520724637367403421848373873279364871895851147873501164141085965889086954824958'; assert(isequal(digit_sum(x),1))

temp = 0 temp = 7 temp = 11 temp = 11 temp = 13 temp = 14 temp = 16 temp = 20 temp = 25 temp = 29 temp = 37 temp = 42 temp = 51 temp = 57 temp = 66 temp = 68 temp = 74 temp = 76 temp = 82 temp = 88 temp = 88 temp = 90 temp = 92 temp = 98 temp = 106 temp = 109 temp = 116 temp = 122 temp = 122 temp = 128 temp = 131 temp = 140 temp = 140 temp = 144 temp = 148 temp = 152 temp = 159 temp = 162 temp = 169 temp = 173 temp = 173 temp = 174 temp = 181 temp = 185 temp = 186 temp = 189 temp = 195 temp = 196 temp = 203 temp = 205 temp = 214 temp = 216 temp = 223 temp = 224 temp = 226 temp = 226 temp = 231 temp = 237 temp = 242 temp = 246 temp = 252 temp = 258 temp = 264 temp = 270 temp = 279 temp = 281 temp = 288 temp = 290 temp = 291 temp = 297 temp = 301 temp = 305 temp = 311 temp = 318 temp = 321 temp = 327 temp = 331 temp = 339 temp = 347 temp = 349 temp = 355 temp = 360 temp = 365 temp = 373 temp = 375 temp = 378 temp = 379 temp = 388 temp = 394 temp = 398 temp = 404 temp = 409 temp = 415 temp = 420 temp = 427 temp = 432 temp = 441 temp = 443 temp = 444 temp = 445 temp = 445 temp = 449 temp = 453 temp = 456 temp = 463 temp = 469 temp = 476 temp = 485 temp = 494 temp = 495 temp = 496 temp = 502 temp = 502 temp = 507 temp = 512 temp = 520 temp = 524 temp = 527 temp = 533 temp = 540 temp = 545 temp = 548 temp = 549 temp = 554 temp = 556 temp = 556 temp = 563 temp = 565 temp = 569 temp = 575 temp = 578 temp = 585 temp = 588 temp = 594 temp = 601 temp = 605 temp = 605 temp = 608 temp = 612 temp = 614 temp = 615 temp = 623 temp = 627 temp = 635 temp = 638 temp = 645 temp = 648 temp = 656 temp = 663 temp = 666 temp = 668 temp = 675 temp = 684 temp = 687 temp = 693 temp = 697 temp = 705 temp = 712 temp = 713 temp = 721 temp = 730 temp = 735 temp = 743 temp = 748 temp = 749 temp = 750 temp = 754 temp = 761 temp = 769 temp = 776 temp = 779 temp = 784 temp = 784 temp = 785 temp = 786 temp = 792 temp = 796 temp = 797 temp = 801 temp = 802 temp = 802 temp = 810 temp = 815 temp = 824 temp = 830 temp = 835 temp = 843 temp = 851 temp = 860 temp = 860 temp = 868 temp = 874 temp = 883 temp = 888 temp = 892 temp = 900 temp = 902 temp = 906 temp = 915 temp = 920 temp = 928 a = '928' temp = 0 temp = 9 temp = 11 temp = 19 a = '19' temp = 0 temp = 1 temp = 10 a = '10' temp = 0 temp = 1 temp = 1 a = '1' s = 1

8   Pass
x = '5851147873501164141085965889086954824958752606678975950184825606304112110625645414882256429011165097708998751310932346085834016381957924478113053129649177515212802040810341932020576007951832700665777265307367115487700079617116367572798033657320723526417122504117269467461912747320644603761100467516110111332287512097531691230649461317836258532443574410236994277771642081168571956087153534120969197542720767643838785694086392663104173875192923061073636098783655224289050890906758861210169349969736226546755550793938442137760897037722646218791104180057313259613054984813997639176837835953637446938790362276560342782718153854834909165636800962412231318093037756803017785098259784452756314377610539928858957504653988358962604698474998342789551842878266142728834686534787064418323355335697481001330501689595534408048368891285568524496673551564873437746977135402808065251650010486580915150789952155706519549648556325841434843312042241472703020112115992435204109497067652723884369953849057131345052221998713'; assert(isequal(digit_sum(x),3))

temp = 0 temp = 5 temp = 13 temp = 18 temp = 19 temp = 20 temp = 24 temp = 31 temp = 39 temp = 46 temp = 49 temp = 54 temp = 54 temp = 55 temp = 56 temp = 62 temp = 66 temp = 67 temp = 71 temp = 72 temp = 72 temp = 80 temp = 85 temp = 94 temp = 100 temp = 105 temp = 113 temp = 121 temp = 130 temp = 130 temp = 138 temp = 144 temp = 153 temp = 158 temp = 162 temp = 170 temp = 172 temp = 176 temp = 185 temp = 190 temp = 198 temp = 205 temp = 210 temp = 212 temp = 218 temp = 218 temp = 224 temp = 230 temp = 237 temp = 245 temp = 254 temp = 261 temp = 266 temp = 275 temp = 280 temp = 280 temp = 281 temp = 289 temp = 293 temp = 301 temp = 303 temp = 308 temp = 314 temp = 314 temp = 320 temp = 323 temp = 323 temp = 327 temp = 328 temp = 329 temp = 331 temp = 332 temp = 333 temp = 333 temp = 339 temp = 341 temp = 346 temp = 352 temp = 356 temp = 361 temp = 365 temp = 366 temp = 370 temp = 378 temp = 386 temp = 388 temp = 390 temp = 395 temp = 401 temp = 405 temp = 407 temp = 416 temp = 416 temp = 417 temp = 418 temp = 419 temp = 425 temp = 430 temp = 430 temp = 439 temp = 446 temp = 453 temp = 453 temp = 461 temp = 470 temp = 479 temp = 487 temp = 494 temp = 499 temp = 500 temp = 503 temp = 504 temp = 504 temp = 513 temp = 516 temp = 518 temp = 521 temp = 525 temp = 531 temp = 531 temp = 539 temp = 544 temp = 552 temp = 555 temp = 559 temp = 559 temp = 560 temp = 566 temp = 569 temp = 577 temp = 578 temp = 587 temp = 592 temp = 599 temp = 608 temp = 610 temp = 614 temp = 618 temp = 625 temp = 633 temp = 634 temp = 635 temp = 638 temp = 638 temp = 643 temp = 646 temp = 647 temp = 649 temp = 658 temp = 664 temp = 668 temp = 677 temp = 678 temp = 685 temp = 692 temp = 697 temp = 698 temp = 703 temp = 705 temp = 706 temp = 708 temp = 716 temp = 716 temp = 718 temp = 718 temp = 722 temp = 722 temp = 730 temp = 731 temp = 731 temp = 734 temp = 738 temp = 739 temp = 748 temp = 751 temp = 753 temp = 753 temp = 755 temp = 755 temp = 760 temp = 767 temp = 773 temp = 773 temp = 773 temp = 780 temp = 789 temp = 794 temp = 795 temp = 803 temp = 806 temp = 808 temp = 815 temp = 815 temp = 815 temp = 821 temp = 827 temp = 832 temp = 839 temp = 846 temp = 853 temp = 855 temp = 861 temp = 866 temp = 869 temp = 869 temp = 876 temp = 879 temp = 885 temp = 892 temp = 893 temp = 894 temp = 899 temp = 903 temp = 911 temp = 918 temp = 925 temp = 925 temp = 925 temp = 925 temp = 932 temp = 941 temp = 947 temp = 948 temp = 955 temp = 956 temp = 957 temp = 963 temp = 966 temp = 972 temp = 979 temp = 984 temp = 991 temp = 993 temp = 1000 temp = 1009 temp = 1017 temp = 1017 temp = 1020 temp = 1023 temp = 1029 temp = 1034 temp = 1041 temp = 1044 temp = 1046 temp = 1046 temp = 1053 temp = 1055 temp = 1058 temp = 1063 temp = 1065 temp = 1071 temp = 1075 temp = 1076 temp = 1083 temp = 1084 temp = 1086 temp = 1088 temp = 1093 temp = 1093 temp = 1097 temp = 1098 temp = 1099 temp = 1106 temp = 1108 temp = 1114 temp = 1123 temp = 1127 temp = 1133 temp = 1140 temp = 1144 temp = 1150 temp = 1151 temp = 1160 temp = 1161 temp = 1163 temp = 1170 temp = 1174 temp = 1181 temp = 1184 temp = 1186 temp = 1186 temp = 1192 temp = 1196 temp = 1200 temp = 1206 temp = 1206 temp = 1209 temp = 1216 temp = 1222 temp = 1223 temp = 1224 temp = 1224 temp = 1224 temp = 1228 temp = 1234 temp = 1241 temp = 1246 temp = 1247 temp = 1253 temp = 1254 temp = 1255 temp = 1255 temp = 1256 temp = 1257 temp = 1258 temp = 1261 temp = 1264 temp = 1266 temp = 1268 temp = 1276 temp = 1283 temp = 1288 temp = 1289 temp = 1291 temp = 1291 temp = 1300 temp = 1307 temp = 1312 temp = 1315 temp = 1316 temp = 1322 temp = 1331 temp = 1332 temp = 1334 temp = 1337 temp = 1337 temp = 1343 temp = 1347 temp = 1356 temp = 1360 temp = 1366 temp = 1367 temp = 1370 temp = 1371 temp = 1378 temp = 1386 temp = 1389 temp = 1395 temp = 1397 temp = 1402 temp = 1410 temp = 1415 temp = 1418 temp = 1420 temp = 1424 temp = 1428 temp = 1431 temp = 1436 temp = 1443 temp = 1447 temp = 1451 temp = 1452 temp = 1452 temp = 1454 temp = 1457 temp = 1463 temp = 1472 temp = 1481 temp = 1485 temp = 1487 temp = 1494 temp = 1501 temp = 1508 temp = 1515 temp = 1516 temp = 1522 temp = 1526 temp = 1528 temp = 1528 temp = 1536 temp = 1537 temp = 1538 temp = 1544 temp = 1552 temp = 1557 temp = 1564 temp = 1565 temp = 1574 temp = 1579 temp = 1585 temp = 1585 temp = 1593 temp = 1600 temp = 1601 temp = 1606 temp = 1609 temp = 1614 temp = 1617 temp = 1621 temp = 1622 temp = 1624 temp = 1624 temp = 1633 temp = 1639 temp = 1648 temp = 1649 temp = 1658 temp = 1665 temp = 1670 temp = 1674 temp = 1676 temp = 1683 temp = 1685 temp = 1685 temp = 1692 temp = 1698 temp = 1705 temp = 1711 temp = 1715 temp = 1718 temp = 1726 temp = 1729 temp = 1737 temp = 1744 temp = 1752 temp = 1757 temp = 1763 temp = 1772 temp = 1776 temp = 1776 temp = 1784 temp = 1790 temp = 1793 temp = 1802 temp = 1804 temp = 1810 temp = 1816 temp = 1819 temp = 1820 temp = 1820 temp = 1824 temp = 1825 temp = 1832 temp = 1835 temp = 1843 temp = 1850 temp = 1855 temp = 1856 temp = 1865 temp = 1867 temp = 1876 temp = 1878 temp = 1881 temp = 1881 temp = 1887 temp = 1888 temp = 1888 temp = 1895 temp = 1898 temp = 1904 temp = 1907 temp = 1913 temp = 1913 temp = 1922 temp = 1930 temp = 1937 temp = 1945 temp = 1948 temp = 1954 temp = 1959 temp = 1964 temp = 1966 temp = 1968 temp = 1972 temp = 1974 temp = 1982 temp = 1991 temp = 1991 temp = 1996 temp = 1996 temp = 2004 temp = 2013 temp = 2013 temp = 2022 temp = 2022 temp = 2028 temp = 2035 temp = 2040 temp = 2048 temp = 2056 temp = 2062 temp = 2063 temp = 2065 temp = 2066 temp = 2066 temp = 2067 temp = 2073 temp = 2082 temp = 2085 temp = 2089 temp = 2098 temp = 2107 temp = 2113 temp = 2122 temp = 2129 temp = ...

9   Pass
x = '908345908234987234589734591724598712345987345273472134987134589764359712459087124587213458149576345917461982455851147873501164141085965889086954824958752606678975950184825606304112110625645414882256429011165097708998751310932346085834016381957924478113053129649177515212802040810341932020576007951832700665777265307367115487700079617116367572798033657320723526417122504117269467461912747320644603761100467516110111332287512097531691230649461317836258532443574410236994277771642081168571956087153534120969197542720767643838785694086392663104173875192923061073636098783655224289050890906758861210169349969736226546755550793938442137760897037722646218791104180057313259613054984813997639176837835953637446938790362276560342782718153854834909165636800962412231318093037756803017785098259784452756314377610539928858957504653988358962604698474998342789551842878266142728834686534787064418323355335697481001330501689595534408048368891285568524496673551564873437746977135402808065251650010486580915150789952155706519549648556325841434843312042241472703020112115992435204109497067652723884369953849057131345059345982439827345092847145091842350981273459871458321098243593498348934598234098145091245845745091240912345931475871452221993493498324734583402901234912925903469023609823768684168426843682436846824645654268462546242684234365243284325436590349324982345923459832145097614359071642509832457234591249314598734590872134590871645098132450921347509237602389760914651346592451257153'; assert(isequal(digit_sum(x),6))

temp = 0 temp = 9 temp = 9 temp = 17 temp = 20 temp = 24 temp = 29 temp = 38 temp = 38 temp = 46 temp = 48 temp = 51 temp = 55 temp = 64 temp = 72 temp = 79 temp = 81 temp = 84 temp = 88 temp = 93 temp = 101 temp = 110 temp = 117 temp = 120 temp = 124 temp = 129 temp = 138 temp = 139 temp = 146 temp = 148 temp = 152 temp = 157 temp = 166 temp = 174 temp = 181 temp = 182 temp = 184 temp = 187 temp = 191 temp = 196 temp = 205 temp = 213 temp = 220 temp = 223 temp = 227 temp = 232 temp = 234 temp = 241 temp = 244 temp = 248 temp = 255 temp = 257 temp = 258 temp = 261 temp = 265 temp = 274 temp = 282 temp = 289 temp = 290 temp = 293 temp = 297 temp = 302 temp = 310 temp = 319 temp = 326 temp = 332 temp = 336 temp = 339 temp = 344 temp = 353 temp = 360 temp = 361 temp = 363 temp = 367 temp = 372 temp = 381 temp = 381 temp = 389 temp = 396 temp = 397 temp = 399 temp = 403 temp = 408 temp = 416 temp = 423 temp = 425 temp = 426 temp = 429 temp = 433 temp = 438 temp = 446 temp = 447 temp = 451 temp = 460 temp = 465 temp = 472 temp = 478 temp = 481 temp = 485 temp = 490 temp = 499 temp = 500 temp = 507 temp = 511 temp = 517 temp = 518 temp = 527 temp = 535 temp = 537 temp = 541 temp = 546 temp = 551 temp = 559 temp = 564 temp = 565 temp = 566 temp = 570 temp = 577 temp = 585 temp = 592 temp = 595 temp = 600 temp = 600 temp = 601 temp = 602 temp = 608 temp = 612 temp = 613 temp = 617 temp = 618 temp = 618 temp = 626 temp = 631 temp = 640 temp = 646 temp = 651 temp = 659 temp = 667 temp = 676 temp = 676 temp = 684 temp = 690 temp = 699 temp = 704 temp = 708 temp = 716 temp = 718 temp = 722 temp = 731 temp = 736 temp = 744 temp = 751 temp = 756 temp = 758 temp = 764 temp = 764 temp = 770 temp = 776 temp = 783 temp = 791 temp = 800 temp = 807 temp = 812 temp = 821 temp = 826 temp = 826 temp = 827 temp = 835 temp = 839 temp = 847 temp = 849 temp = 854 temp = 860 temp = 860 temp = 866 temp = 869 temp = 869 temp = 873 temp = 874 temp = 875 temp = 877 temp = 878 temp = 879 temp = 879 temp = 885 temp = 887 temp = 892 temp = 898 temp = 902 temp = 907 temp = 911 temp = 912 temp = 916 temp = 924 temp = 932 temp = 934 temp = 936 temp = 941 temp = 947 temp = 951 temp = 953 temp = 962 temp = 962 temp = 963 temp = 964 temp = 965 temp = 971 temp = 976 temp = 976 temp = 985 temp = 992 temp = 999 temp = 999 temp = 1007 temp = 1016 temp = 1025 temp = 1033 temp = 1040 temp = 1045 temp = 1046 temp = 1049 temp = 1050 temp = 1050 temp = 1059 temp = 1062 temp = 1064 temp = 1067 temp = 1071 temp = 1077 temp = 1077 temp = 1085 temp = 1090 temp = 1098 temp = 1101 temp = 1105 temp = 1105 temp = 1106 temp = 1112 temp = 1115 temp = 1123 temp = 1124 temp = 1133 temp = 1138 temp = 1145 temp = 1154 temp = 1156 temp = 1160 temp = 1164 temp = 1171 temp = 1179 temp = 1180 temp = 1181 temp = 1184 temp = 1184 temp = 1189 temp = 1192 temp = 1193 temp = 1195 temp = 1204 temp = 1210 temp = 1214 temp = 1223 temp = 1224 temp = 1231 temp = 1238 temp = 1243 temp = 1244 temp = 1249 temp = 1251 temp = 1252 temp = 1254 temp = 1262 temp = 1262 temp = 1264 temp = 1264 temp = 1268 temp = 1268 temp = 1276 temp = 1277 temp = 1277 temp = 1280 temp = 1284 temp = 1285 temp = 1294 temp = 1297 temp = 1299 temp = 1299 temp = 1301 temp = 1301 temp = 1306 temp = 1313 temp = 1319 temp = 1319 temp = 1319 temp = 1326 temp = 1335 temp = 1340 temp = 1341 temp = 1349 temp = 1352 temp = 1354 temp = 1361 temp = 1361 temp = 1361 temp = 1367 temp = 1373 temp = 1378 temp = 1385 temp = 1392 temp = 1399 temp = 1401 temp = 1407 temp = 1412 temp = 1415 temp = 1415 temp = 1422 temp = 1425 temp = 1431 temp = 1438 temp = 1439 temp = 1440 temp = 1445 temp = 1449 temp = 1457 temp = 1464 temp = 1471 temp = 1471 temp = 1471 temp = 1471 temp = 1478 temp = 1487 temp = 1493 temp = 1494 temp = 1501 temp = 1502 temp = 1503 temp = 1509 temp = 1512 temp = 1518 temp = 1525 temp = 1530 temp = 1537 temp = 1539 temp = 1546 temp = 1555 temp = 1563 temp = 1563 temp = 1566 temp = 1569 temp = 1575 temp = 1580 temp = 1587 temp = 1590 temp = 1592 temp = 1592 temp = 1599 temp = 1601 temp = 1604 temp = 1609 temp = 1611 temp = 1617 temp = 1621 temp = 1622 temp = 1629 temp = 1630 temp = 1632 temp = 1634 temp = 1639 temp = 1639 temp = 1643 temp = 1644 temp = 1645 temp = 1652 temp = 1654 temp = 1660 temp = 1669 temp = 1673 temp = 1679 temp = 1686 temp = 1690 temp = 1696 temp = 1697 temp = 1706 temp = 1707 temp = 1709 temp = 1716 temp = 1720 temp = 1727 temp = 1730 temp = 1732 temp = 1732 temp = 1738 temp = 1742 temp = 1746 temp = 1752 temp = 1752 temp = 1755 temp = 1762 temp = 1768 temp = 1769 temp = 1770 temp = 1770 temp = 1770 temp = 1774 temp = 1780 temp = 1787 temp = 1792 temp = 1793 temp = 1799 temp = 1800 temp = 1801 temp = 1801 temp = 1802 temp = 1803 temp = 1804 temp = 1807 temp = 1810 temp = 1812 temp = 1814 temp = 1822 temp = 1829 temp = 1834 temp = 1835 temp = 1837 temp = 1837 temp = 1846 temp = 1853 temp = 1858 temp = 1861 temp = 1862 temp = 1868 temp = 1877 temp = 1878 temp = 1880 temp = 1883 temp = 1883 temp = 1889 temp = 1893 temp = 1902 temp = 1906 temp = 1912 temp = 1913 temp = 1916 temp = 1917 temp = 1924 temp = 1932 temp = 1935 temp = 1941 temp = 1943 temp = 1948 temp = 1956 temp = 1961 temp = 1964 temp = 1966 temp = 1970 temp = 1974 temp = 1977 temp = 1982 temp = 1989 temp = 1993 temp = 1997 temp = 1998 temp = 1998 temp = 2000 temp = 2003 temp = 2009 temp = 2018 temp = 2027 temp = 2031 temp = 2033 temp = 2040 temp = 2047 temp = 2054 temp = 2061 temp = 2062 temp = 2068 temp = 2072 temp = 2074 temp = 2074 temp = 2082 temp = 2083 temp = 2084 temp = 2090 temp = 2098 temp = 2103 temp = 2110 temp = 2111 temp = 2120 temp = 2125 temp = 2131 temp = ...