Cody

Solution 2123659

Submitted on 10 Feb 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','FileName','digit_sum.m')

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

digits = 1 2 3 4 5 6 7 8 9 s = 45

Assertion failed.

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

digits = 1 3 5 7 9 s = 25

Assertion failed.

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

digits = 1 9 9 s = 19

Assertion failed.

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

digits = 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 s = 199

Assertion failed.

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

digits = Columns 1 through 30 1 0 3 6 6 5 4 2 5 7 7 5 7 6 1 5 3 0 1 1 6 4 6 2 0 5 2 9 9 3 Columns 31 through 60 0 6 8 9 0 4 5 6 7 6 7 3 5 1 0 9 2 5 9 1 1 3 9 3 2 1 3 3 1 4 Columns 61 through 90 0 6 0 5 7 2 4 5 0 4 6 2 8 9 8 5 2 7 2 9 6 6 1 0 2 8 9 6 7 2 Columns 91 through 100 5 8 4 9 0 3 5 0 7 5 s = 428

Assertion failed.

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

digits = Columns 1 through 30 7 4 0 2 1 2 4 5 4 8 5 9 6 9 2 6 2 6 6 0 2 2 6 8 3 7 6 0 6 3 Columns 31 through 60 9 0 4 4 4 7 3 7 4 0 1 7 4 1 3 6 1 7 2 9 2 7 1 2 0 5 6 5 4 6 Columns 61 through 90 6 6 6 9 2 7 2 1 6 4 4 6 7 3 6 4 8 8 2 6 5 5 8 2 3 1 9 6 4 6 Columns 91 through 120 5 6 5 7 5 9 2 1 1 0 4 4 3 7 6 7 9 9 1 1 6 0 5 5 8 4 3 6 7 5 Columns 121 through 150 3 1 5 2 0 7 2 4 6 3 7 3 6 7 4 0 3 4 2 1 8 4 8 3 7 3 8 7 3 2 Columns 151 through 180 7 9 3 6 4 8 7 1 8 9 5 8 5 1 1 4 7 8 7 3 5 0 1 1 6 4 1 4 1 0 Columns 181 through 200 8 5 9 6 5 8 8 9 0 8 6 9 5 4 8 2 4 9 5 8 s = 928

Assertion failed.

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

digits = Columns 1 through 30 5 8 5 1 1 4 7 8 7 3 5 0 1 1 6 4 1 4 1 0 8 5 9 6 5 8 8 9 0 8 Columns 31 through 60 6 9 5 4 8 2 4 9 5 8 7 5 2 6 0 6 6 7 8 9 7 5 9 5 0 1 8 4 8 2 Columns 61 through 90 5 6 0 6 3 0 4 1 1 2 1 1 0 6 2 5 6 4 5 4 1 4 8 8 2 2 5 6 4 2 Columns 91 through 120 9 0 1 1 1 6 5 0 9 7 7 0 8 9 9 8 7 5 1 3 1 0 9 3 2 3 4 6 0 8 Columns 121 through 150 5 8 3 4 0 1 6 3 8 1 9 5 7 9 2 4 4 7 8 1 1 3 0 5 3 1 2 9 6 4 Columns 151 through 180 9 1 7 7 5 1 5 2 1 2 8 0 2 0 4 0 8 1 0 3 4 1 9 3 2 0 2 0 5 7 Columns 181 through 210 6 0 0 7 9 5 1 8 3 2 7 0 0 6 6 5 7 7 7 2 6 5 3 0 7 3 6 7 1 1 Columns 211 through 240 5 4 8 7 7 0 0 0 7 9 6 1 7 1 1 6 3 6 7 5 7 2 7 9 8 0 3 3 6 5 Columns 241 through 270 7 3 2 0 7 2 3 5 2 6 4 1 7 1 2 2 5 0 4 1 1 7 2 6 9 4 6 7 4 6 Columns 271 through 300 1 9 1 2 7 4 7 3 2 0 6 4 4 6 0 3 7 6 1 1 0 0 4 6 7 5 1 6 1 1 Columns 301 through 330 0 1 1 1 3 3 2 2 8 7 5 1 2 0 9 7 5 3 1 6 9 1 2 3 0 6 4 9 4 6 Columns 331 through 360 1 3 1 7 8 3 6 2 5 8 5 3 2 4 4 3 5 7 4 4 1 0 2 3 6 9 9 4 2 7 Columns 361 through 390 7 7 7 1 6 4 2 0 8 1 1 6 8 5 7 1 9 5 6 0 8 7 1 5 3 5 3 4 1 2 Columns 391 through 420 0 9 6 9 1 9 7 5 4 2 7 2 0 7 6 7 6 4 3 8 3 8 7 8 5 6 9 4 0 8 Columns 421 through 450 6 3 9 2 6 6 3 1 0 4 1 7 3 8 7 5 1 9 2 9 2 3 0 6 1 0 7 3 6 3 Columns 451 through 480 6 0 9 8 7 8 3 6 5 5 2 2 4 2 8 9 0 5 0 8 9 0 9 0 6 7 5 8 8 6 Columns 481 through 510 1 2 1 0 1 6 9 3 4 9 9 6 9 7 3 6 2 2 6 5 4 6 7 5 5 5 5 0 7 9 Columns 511 through 540 3 9 3 8 4 4 2 1 3 7 7 6 0 8 9 7 0 3 7 7 2 2 6 4 6 2 1 8 7 9 Columns 541 through 570 1 1 0 4 1 8 0 0 5 7 3 1 3 2 5 9 6 1 3 0 5 4 9 8 4 8 1 3 9 9 Columns 571 through 600 7 6 3 9 1 7 6 8 3 7 8 3 5 9 5 3 6 3 7 4 4 6 9 3 8 7 9 0 3 6 Columns 601 through 630 2 2 7 6 5 6 0 3 4 2 7 8 2 7 1 8 1 5 3 8 5 4 8 3 4 9 0 9 1 6 Columns 631 through 660 5 6 3 6 8 0 0 9 6 2 4 1 2 2 3 1 3 1 8 0 9 3 0 3 7 7 5 6 8 0 Columns 661 through 690 3 0 1 7 7 8 5 0 9 8 2 5 9 7 8 4 4 5 2 7 5 6 3 1 4 3 7 7 6 1 Columns 691 through 720 0 5 3 9 9 2 8 8 5 8 9 5 7 5 0 4 6 5 3 9 8 8 3 5 8 9 6 2 6 0 Columns 721 through 750 4 6 9 8 4 7 4 9 9 8 3 4 2 7 8 9 5 5 1 8 4 2 8 7 8 2 6 6 1 4 Columns 751 through 780 2 7 2 8 8 3 4 6 8 6 5 3 4 7 8 7 0 6 4 4 1 8 3 2 3 3 5 5 3 3 Columns 781 through 810 5 6 9 7 4 8 1 0 0 1 3 3 0 5 0 1 6 8 9 5 9 5 5 3 4 4 0 8 0 4 Columns 811 through 840 8 3 6 8 8 9 1 2 8 5 5 6 8 5 2 4 4 9 6 6 7 3 5 5 1 5 6 4 8 7 Columns 841 through 870 3 4 3 7 7 4 6 9 7 7 1 3 5 4 0 2 8 0 8 0 6 5 2 5 1 6 5 0 0 1 Columns 871 through 900 0 4 8 6 5 8 0 9 1 5 1 5 0 7 8 9 9 5 2 1 5 5 7 0 6 5 1 9 5 4 Columns 901 through 930 9 6 4 8 5 5 6 3 2 5 8 4 1 4 3 4 8 4 3 3 1 2 0 4 2 2 4 1 4 7 Columns 931 through 960 2 7 0 3 0 2 0 1 1 2 1 1 5 9 9 2 4 3 5 2 0 4 1 0 9 4 9 7 0 6 Columns 961 through 990 7 6 5 2 7 2 3 8 8 4 3 6 9 9 5 3 8 4 9 0 5 7 1 3 1 3 4 5 0 5 Columns 991 through 1000 2 2 2 1 9 9 8 7 1 3 s = 4458

Assertion failed.

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

digits = Columns 1 through 30 9 0 8 3 4 5 9 0 8 2 3 4 9 8 7 2 3 4 5 8 9 7 3 4 5 9 1 7 2 4 Columns 31 through 60 5 9 8 7 1 2 3 4 5 9 8 7 3 4 5 2 7 3 4 7 2 1 3 4 9 8 7 1 3 4 Columns 61 through 90 5 8 9 7 6 4 3 5 9 7 1 2 4 5 9 0 8 7 1 2 4 5 8 7 2 1 3 4 5 8 Columns 91 through 120 1 4 9 5 7 6 3 4 5 9 1 7 4 6 1 9 8 2 4 5 5 8 5 1 1 4 7 8 7 3 Columns 121 through 150 5 0 1 1 6 4 1 4 1 0 8 5 9 6 5 8 8 9 0 8 6 9 5 4 8 2 4 9 5 8 Columns 151 through 180 7 5 2 6 0 6 6 7 8 9 7 5 9 5 0 1 8 4 8 2 5 6 0 6 3 0 4 1 1 2 Columns 181 through 210 1 1 0 6 2 5 6 4 5 4 1 4 8 8 2 2 5 6 4 2 9 0 1 1 1 6 5 0 9 7 Columns 211 through 240 7 0 8 9 9 8 7 5 1 3 1 0 9 3 2 3 4 6 0 8 5 8 3 4 0 1 6 3 8 1 Columns 241 through 270 9 5 7 9 2 4 4 7 8 1 1 3 0 5 3 1 2 9 6 4 9 1 7 7 5 1 5 2 1 2 Columns 271 through 300 8 0 2 0 4 0 8 1 0 3 4 1 9 3 2 0 2 0 5 7 6 0 0 7 9 5 1 8 3 2 Columns 301 through 330 7 0 0 6 6 5 7 7 7 2 6 5 3 0 7 3 6 7 1 1 5 4 8 7 7 0 0 0 7 9 Columns 331 through 360 6 1 7 1 1 6 3 6 7 5 7 2 7 9 8 0 3 3 6 5 7 3 2 0 7 2 3 5 2 6 Columns 361 through 390 4 1 7 1 2 2 5 0 4 1 1 7 2 6 9 4 6 7 4 6 1 9 1 2 7 4 7 3 2 0 Columns 391 through 420 6 4 4 6 0 3 7 6 1 1 0 0 4 6 7 5 1 6 1 1 0 1 1 1 3 3 2 2 8 7 Columns 421 through 450 5 1 2 0 9 7 5 3 1 6 9 1 2 3 0 6 4 9 4 6 1 3 1 7 8 3 6 2 5 8 Columns 451 through 480 5 3 2 4 4 3 5 7 4 4 1 0 2 3 6 9 9 4 2 7 7 7 7 1 6 4 2 0 8 1 Columns 481 through 510 1 6 8 5 7 1 9 5 6 0 8 7 1 5 3 5 3 4 1 2 0 9 6 9 1 9 7 5 4 2 Columns 511 through 540 7 2 0 7 6 7 6 4 3 8 3 8 7 8 5 6 9 4 0 8 6 3 9 2 6 6 3 1 0 4 Columns 541 through 570 1 7 3 8 7 5 1 9 2 9 2 3 0 6 1 0 7 3 6 3 6 0 9 8 7 8 3 6 5 5 Columns 571 through 600 2 2 4 2 8 9 0 5 0 8 9 0 9 0 6 7 5 8 8 6 1 2 1 0 1 6 9 3 4 9 Columns 601 through 630 9 6 9 7 3 6 2 2 6 5 4 6 7 5 5 5 5 0 7 9 3 9 3 8 4 4 2 1 3 7 Columns 631 through 660 7 6 0 8 9 7 0 3 7 7 2 2 6 4 6 2 1 8 7 9 1 1 0 4 1 8 0 0 5 7 Columns 661 through 690 3 1 3 2 5 9 6 1 3 0 5 4 9 8 4 8 1 3 9 9 7 6 3 9 1 7 6 8 3 7 Columns 691 through 720 8 3 5 9 5 3 6 3 7 4 4 6 9 3 8 7 9 0 3 6 2 2 7 6 5 6 0 3 4 2 Columns 721 through 750 7 8 2 7 1 8 1 5 3 8 5 4 8 3 4 9 0 9 1 6 5 6 3 6 8 0 0 9 6 2 Columns 751 through 780 4 1 2 2 3 1 3 1 8 0 9 3 0 3 7 7 5 6 8 0 3 0 1 7 7 8 5 0 9 8 Columns 781 through 810 2 5 9 7 8 4 4 5 2 7 5 6 3 1 4 3 7 7 6 1 0 5 3 9 9 2 8 8 5 8 Columns 811 through 840 9 5 7 5 0 4 6 5 3 9 8 8 3 5 8 9 6 2 6 0 4 6 9 8 4 7 4 9 9 8 Columns 841 through 870 3 4 2 7 8 9 5 5 1 8 4 2 8 7 8 2 6 6 1 4 2 7 2 8 8 3 4 6 8 6 Columns 871 through 900 5 3 4 7 8 7 0 6 4 4 1 8 3 2 3 3 5 5 3 3 5 6 9 7 4 8 1 0 0 1 Columns 901 through 930 3 3 0 5 0 1 6 8 9 5 9 5 5 3 4 4 0 8 0 4 8 3 6 8 8 9 1 2 8 5 Columns 931 through 960 5 6 8 5 2 4 4 9 6 6 7 3 5 5 1 5 6 4 8 7 3 4 3 7 7 4 6 9 7 7 Columns 961 through 990 1 3 5 4 0 2 8 0 8 0 6 5 2 5 1 6 5 0 0 1 0 4 8 6 5 8 0 9 1 5 Columns 991 through 1020 1 5 0 7 8 9 9 5 2 1 5 5 7 0 6 5 1 9 5 4 9 6 4 8 5 5 6 3 2 5 Columns 1021 through 1050 8 4 1 4 3 4 8 4 3 3 1 2 0 4 2 2 4 1 4 7 2 7 0 3 0 2 0 1 1 2 Columns 1051 through 1080 1 1 5 9 9 2 4 3 5 2 0 4 1 0 9 4 9 7 0 6 7 6 5 2 7 2 3 8 8 4 Columns 1081 through 1110 3 6 9 9 5 3 8 4 9 0 5 7 1 3 1 3 4 5 0 5 9 3 4 5 9 8 2 4 3 9 Columns 1111 through 1140 8 2 7 3 4 5 0 9 2 8 4 7 1 4 5 0 9 1 8 4 2 3 5 0 9 8 1 2 7 3 Columns 1141 through 1170 4 5 9 8 7 1 4 5 8 3 2 1 0 9 8 2 4 3 5 9 3 4 9 8 3 4 8 9 3 4 Columns 1171 through 1200 5 9 8 2 3 4 0 9 8 1 4 5 0 9 1 2 4 5 8 4 5 7 4 5 0 9 1 2 4 0 Columns 1201 through 1230 9 1 2 3 4 5 9 3 1 4 7 5 8 7 1 4 5 2 2 2 1 9 9 3 4 9 3 4 9 8 Columns 1231 through 1260 3 2 4 7 3 4 5 8 3 4 0 2 9 0 1 2 3 4 9 1 2 9 2 5 9 0 3 4 6 9 Columns 1261 through 1290 0 2 3 6 0 9 8 2 3 7 6 8 6 8 4 1 6 8 4 2 6 8 4 3 6 8 2 4 3 6 Columns 1291 through 1320 8 4 6 8 2 4 6 4 5 6 5 4 2 6 8 4 6 2 5 4 6 2 4 2 6 8 4 2 3 4 Columns 1321 through 1350 3 6 5 2 4 3 2 8 4 3 2 5 4 3 6 5 9 0 3 4 9 3 2 4 9 8 2 3 4 5 Columns 1351 through 1380 9 2 3 4 5 9 8 3 2 1 4 5 0 9 7 6 1 4 3 5 9 0 7 1 6 4 2 5 0 9 Columns 1381 through 1410 8 3 2 4 5 7 2 3 4 5 9 1 2 4 9 3 1 4 5 9 8 7 3 4 5 9 0 8 7 2 Columns 1411 through 1440 1 3 4 5 9 0 8 7 1 6 4 5 0 9 8 1 3 2 4 ...

Assertion failed.