Cody

# Problem 3079. Big numbers, repeated least significant digits

Solution 2701940

Submitted on 16 Jul 2020 at 15:04
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
x = 2; n_correct = 5; assert(isequal(bigNumRepeat(x),n_correct))

xv2po = '4' xv2po = '8' xv2po = '16' xv2po = '32' n = 5

2   Fail
x = 10; n_correct = inf; assert(isequal(bigNumRepeat(x),n_correct))

xv2po = '100' xv2po = '1000' xv2po = '10000' xv2po = '100000' xv2po = '1000000' xv2po = '10000000' xv2po = '100000000' xv2po = '1000000000' xv2po = '10000000000' xv2po = '100000000000' xv2po = '1000000000000' xv2po = '10000000000000' xv2po = '100000000000000' xv2po = '1000000000000000' xv2po = '10000000000000000' xv2po = '100000000000000000' xv2po = '1000000000000000000' xv2po = '10000000000000000000' xv2po = '100000000000000000000' xv2po = '1000000000000000000000' xv2po = '10000000000000000000000' xv2po = '100000000000000000000000' xv2po = '1000000000000000000000000' xv2po = '10000000000000000000000000' xv2po = '100000000000000000000000000' xv2po = '1000000000000000000000000000' xv2po = '10000000000000000000000000000' xv2po = '100000000000000000000000000000' xv2po = '1000000000000000000000000000000' xv2po = '10000000000000000000000000000000' xv2po = '100000000000000000000000000000000' xv2po = '1000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' xv2po = '1000000000000000000000000000000000000000000...

Output argument "n" (and maybe others) not assigned during call to "bigNumRepeat". Error in Test2 (line 3) assert(isequal(bigNumRepeat(x),n_correct))

3   Fail
x = [3 7 33 51 67 192 329 678 680 4731 10016 10081 35197 35199 51783 517839 517842]; n_correct = [5 5 21 3 21 101 51 inf inf 501 626 626 5001 251 2501 12501 inf]; for ii = 1:numel(x) assert(isequal(bigNumRepeat(x(ii)),n_correct(ii))) end

xv2po = '9' xv2po = '27' xv2po = '81' xv2po = '243' n = 5 xv2po = '49' xv2po = '343' xv2po = '2401' xv2po = '16807' n = 5 xv2po = '1089' xv2po = '35937' xv2po = '1185921' xv2po = '39135393' xv2po = '1291467969' xv2po = '42618442977' xv2po = '1406408618241' xv2po = '46411484401953' xv2po = '1531578985264449' xv2po = '50542106513726817' xv2po = '1667889514952984961' xv2po = '55040353993448503713' xv2po = '1816331681783800622529' xv2po = '59938945498865420543457' xv2po = '1977985201462558877934081' xv2po = '65273511648264442971824673' xv2po = '2154025884392726618070214209' xv2po = '71082854184959978396317068897' xv2po = '2345734188103679287078463273601' xv2po = '77409228207421416473589288028833' n = 21 xv2po = '2601' xv2po = '132651' n = 3 xv2po = '4489' xv2po = '300763' xv2po = '20151121' xv2po = '1350125107' xv2po = '90458382169' xv2po = '6060711605323' xv2po = '406067677556641' xv2po = '27206534396294947' xv2po = '1822837804551761449' xv2po = '122130132904968017083' xv2po = '8182718904632857144561' xv2po = '548242166610401428685587' xv2po = '36732225162896895721934329' xv2po = '2461059085914092013369600043' xv2po = '164890958756244164895763202881' xv2po = '11047694236668359048016134593027' xv2po = '740195513856780056217081017732809' xv2po = '49593099428404263766544428188098203' xv2po = '3322737661703085672358476688602579601' xv2po = '222623423334106740048017938136372833267' n = 21 xv2po = '4096' xv2po = '-262144' xv2po = '16777216' xv2po = '-1073741824' xv2po = '68719476736' xv2po = '-4398046511104' xv2po = '281474976710656' xv2po = '-18014398509481984' xv2po = '1152921504606846976' xv2po = '-73786976294838206464' xv2po = '4722366482869645213696' xv2po = '-302231454903657293676544' xv2po = '19342813113834066795298816' xv2po = '-1237940039285380274899124224' xv2po = '79228162514264337593543950336' xv2po = '-5070602400912917605986812821504' xv2po = '324518553658426726783156020576256' xv2po = '-20769187434139310514121985316880384' xv2po = '1329227995784915872903807060280344576' xv2po = '-85070591730234615865843651857942052864' xv2po = '5444517870735015415413993718908291383296' xv2po = '-348449143727040986586495598010130648530944' xv2po = '22300745198530623141535718272648361505980416' xv2po = '-1427247692705959881058285969449495136382746624' xv2po = '91343852333181432387730302044767688728495783936' xv2po = '-5846006549323611672814739330865132078623730171904' xv2po = '374144419156711147060143317175368453031918731001856' xv2po = '-23945242826029513411849172299223580994042798784118784' xv2po = '1532495540865888858358347027150309183618739122183602176' xv2po = '-98079714615416886934934209737619787751599303819750539264' xv2po = '6277101735386680763835789423207666416102355444464034512896' xv2po = '-401734511064747568885490523085290650630550748445698208825344' xv2po = '25711008708143844408671393477458601640355247900524685364822016' xv2po = '-1645504557321206042154969182557350504982735865633579863348609024' xv2po = '105312291668557186697918027683670432318895095400549111254310977536' xv2po = '-6739986666787659948666753771754907668409286105635143120275902562304' xv2po = '431359146674410236714672241392314090778194310760649159697657763987456' xv2po = '-27606985387162255149739023449108101809804435888681546220650096895197184' xv2po = '1766847064778384329583297500742918515827483896875618958121606201292619776' xv2po = '-113078212145816597093331040047546785012958969400039613319782796882727665664' xv2po = '7237005577332262213973186563042994240829374041602535252466099000494570602496' xv2po = '-463168356949264781694283940034751631413079938662562256157830336031652518559744' xv2po = '29642774844752946028434172162224104410437116074403984394101141506025761187823616' xv2po = '-1897137590064188545819787018382342682267975428761855001222473056385648716020711424' xv2po = '121416805764108066932466369176469931665150427440758720078238275608681517825325531136' xv2po = '-7770675568902916283677847627294075626569627356208558085007249638955617140820833992704' xv2po = '497323236409786642155382248146820840100456150797347717440463976893159497012533375533056' xv2po = '-31828687130226345097944463881396533766429193651030253916189694521162207808802136034115584' xv2po = '2037035976334486086268445688409378161051468393665936250636140449354381299763336706183397376' xv2po = '-130370302485407109521180524058200202307293977194619920040712988758680403184853549195737432064' xv2po = '8343699359066055009355553539724812947666814540455674882605631280555545803830627148527195652096' xv2po = '-533996758980227520598755426542388028650676130589163192486760401955554931445160137505740521734144' xv2po = '34175792574734561318320347298712833833643272357706444319152665725155515612490248800367393390985216' xv2po = '-2187250724783011924372502227117621365353169430893212436425770606409952999199375923223513177023053824' xv2po = '139984046386112763159840142535527767382602843577165595931249318810236991948760059086304843329475444736' xv2po = '-8958978968711216842229769122273777112486581988938598139599956403855167484720643781523509973086428463104' xv2po = '573374653997517877902705223825521735199141247292070280934397209846730719022121202017504638277531421638656' xv2po = '-36695977855841144185773134324833391052745039826692497979801421430190766017415756929120296849762010984873984' xv2po = '2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976' xv2po = '-150306725297525326584926758194517569752043683130132471725266622178061377607334940381676735896625196994043838464' xv2po = '9619630419041620901435312524449124464130795720328478190417063819395928166869436184427311097384012607618805661696' xv2po = '-615656346818663737691860001564743965704370926101022604186692084441339402679643915803347910232576806887603562348544' xv2po = '39402006196394479212279040100143613805079739270465446667948293404245721771497210611414266254884915640806627990306816' xv2po = '-2521728396569246669585858566409191283525103313309788586748690777871726193375821479130513040312634601011624191379636224' xv2po = '161390617380431786853494948250188242145606612051826469551916209783790476376052574664352834580008614464743948248296718336' xv2po = '-10328999512347634358623676688012047497318823171316894051322637426162590488067364778518581413120551325743612687890989973504' xv2po = '661055968790248598951915308032771039828404682964281219284648795274405791236311345825189210439715284847591212025023358304256' xv2po = '-42307582002575910332922579714097346549017899709713998034217522897561970639123926132812109468141778230245837569601494931472384' xv2po = '2707685248164858261307045101702230179137145581421695874189921465443966120903931272499975005961073806735733604454495675614232576' xv2po = '-173291855882550928723650886508942731464777317210988535948154973788413831737851601439998400381508723631086950685087723239310884864' xv2po = '11090678776483259438313656736572334813745748301503266300681918322458485231222502492159897624416558312389564843845614287315896631296' xv2po = '-709803441694928604052074031140629428079727891296209043243642772637343054798240159498233447962659731992932150006119314388217384402944' xv2po = '45427420268475430659332737993000283397102585042957378767593137448789955507087370207886940669610222847547657600391636120845912601788416' xv2po = '-2907354897182427562197295231552018137414565442749272241125960796722557152453591693304764202855054262243050086425064711734138406514458624' xv2po = '186070713419675363980626894819329160794532188335953423432061490990243657757029868371504908982723472783555205531204141550984858016925351936' xv2po = '-11908525658859223294760121268437066290850060053501019099651935423375594096449911575776314174894302258147533153997065059263030913083222523904' xv2po = '762145642166990290864647761179972242614403843424065222377723867096038022172794340849684107193235344521442121855812163792833978437326241529856' xv2po = '-48777321098687378615337456715518223527321845979140174232174327494146433419058837814379782860367062049372295798771978482741374619988879457910784' xv2po = '3121748550315992231381597229793166305748598142664971150859156959625371738819765620120306103063491971159826931121406622895447975679288285306290176' xv2po = '-199791907220223502808422222706762643567910281130558153654986045416023791284464999687699590596063486154228923591770023865308670443474450259602571264' xv2po = '12786682062094304179739022253232809188346257992355721833919106906625522642205759980012773798148063113870651109873281527379754908382364816614564560896' xv2po = '-818347651974035467503297424206899788054160511510766197370822842024033449101168638720817523081476039287721671031890017752304314136471348263332131897344' xv2po = '52374249726338269920211035149241586435466272736689036631732661889538140742474792878132321477214466514414186946040961136147476104734166288853256441430016' xv2po = '-3351951982485649274893506249551461531869841455148098344430890360930441007518386744200468574541725856922507964546621512713438470702986642486608412251521024' xv2po = ...

Output argument "n" (and maybe others) not assigned during call to "bigNumRepeat". Error in Test3 (line 4) assert(isequal(bigNumRepeat(x(ii)),n_correct(ii)))