Multiplicity

From Esolang
Jump to navigation Jump to search
Multiplicity
Paradigm(s) imperative
Designed by None1
Appeared in 2023
Memory system Cell-based
Dimensions zero-dimensional
Computational class Turing complete
Major implementations Python
Influenced by brainfuck, Factor
File extension(s) .mul

Multiplicity or mul is an esolang invented by User:None1. It is inspired by Factor.

Syntax

The esolang is based on prime factorization, but unlike Factor, the esolang focuses on the multiplicity of each prime rather than the primes themselves.

Any program in this esolang is a number. When executed, the following procedures are performed:

  1. Factorize the number.
  2. Sort the prime factors in ascending order. (The prime factors do not have to be consecutive, e.g. the result of 28*117 is also valid and it works like a one time cat program)
  3. For every prime factor, convert its multiplicity modulo 8 to a brainfuck command using the table below.
Conversion table
Multiplicity modulo 8 brainfuck
0 ,
1 +
2 -
3 >
4 <
5 [
6 ]
7 .

Finally, execute the brainfuck code you get.

Example Programs

Cat Program

49633705594394460000000

Which is 28*35*57*78*116

Hello World

15346842977917005271348291087877327960473799359628915827742017092506552727314524984919408898619237240192856164643350877303136147390834695879019084876895805482752634659548180531381997909947020729554587793691281332038380252951475909118080395672789975530690126351481352917316779855967978827751675294950311254585287565383451513382797221247321873473654574955735985520973890508864013576785399287971549432485617658927790655806810238112628554773467104844982276419228205664426887061807027322697693321541017444002959692022026086939587171742042356692488673901123868928580202359967910980482626023632356483793629321316061019208587309442834734770048543403999538188666166261097354514754397190215630

Which is 21*31*51*71*111*131*171*191*235*293*311*371*411*431*475*533*591*611*673*711*731*791*833*891*971*1011*1033*1071*1094*1134*1274*1314*1372*1396*1493*1511*1573*1631*1673*1732*1793*1813*1911*1935*1974*1996*2114*2232*2276*2293*2333*2397*2413*2512*2572*2632*2697*2711*2771*2811*2831*2931*3071*3111*3137*3177*3311*3371*3471*3497*3533*3593*3677*3734*3792*3837*3894*3977*4011*4091*4191*4217*4312*4332*4392*4432*4492*4572*4617*4632*4672*4792*4872*4912*4992*5032*5092*5217*5233*5413*5471*5577*5633*5691*5711*5777

Truth Machine

118071647211412086898211358264705461979787711333662974052999075081831990616126551203385347476991450766465425271276110272235428316373617833753786477575425129326370001272292039629148144159000

Which is 23*33*53*78*117*135*175*192*233*291*314*374*411*433*476*533*592*616*674*714*734*795*834*894*976*1013*1035*1077*1096

99 Bottles of Beer

The program is really looooooooooong (it is about 26 KB long), and that makes this page the 31st longest page in this wiki.

42658840589963078431731150584099507242785777758515704740657482757850511142994079656798415847173257999001658697190643688550698729431167215519508809150403523797035769839048911746673745460649877365150761142707567374429586034848102815604091203327022139496691444796305037556522597898787359700916162510590597707332318582934302604577025330769638876665099415724782000105021241698944181737626295284384604533437111121408916104057444608084475234114450423388639089983262154722476063860129543541895154662216357689433073789697761020983371331866570900814321754803700019546258842282060523224135213443145368203128718486384821446658738329686930934154836628142346616195273518797875630922356364097404491504186229304486325410910516557007654455675843858977283060908611128875009352937425294751817518576654729948408237156016596701724649109527384021532192973996273070450712977876984552520244356270914886147098142725099037217702799505648964309600879947896578213348606449238370258383465353569092811183901153076629196735678366302058951812476881350006010274192010857220871931800534268671761461797884069012607527753935566072584145627931439175440165916908915390811735296839244855949205322291113213253189175096645641406469883389466504134262884742764794108706572469293425241387570235818988533021351995046370288490424886612841525030836692959252754701992677355108924453721967196419268627090647943786840402448044802270747537404276059042995294798383603587446431519715240541236038942688528770086020863774543916085399542654214340864082045028601025784657461946487497559341942012215949373747647952855401653258665252922576946574588744793442553428627943444132242084543948655955773693667974413494568246132377611682894054752700875459379549730331694286964969525513082288480806665900333382103981682899967951015626250157946858679936006485834204033008870654927038036262948226878400255125990047352177484294086289628269533458829640740842710768296582529601760071063650188286146471434151556618271186987185641027528560616597090835303344709735716033205110824412803832382233849866630063151526016357675487402047571778834798336598283548027966368282856221769634372502133058235607503092972405104062069924975128270467782740070110097576177088975500649912519727322879266736743339356028097606785743431511489565616567438943410385302937938846225944396760768108041247608768252097406557489826652945557726461023041291788192887557097503050225767128627308378304652909618156678822233932101202344677067242865395703674340837607782001365442898030288800787447067604535517981378217434058455848172744211613671734434313944602171113844243648917614870990110196022858017727265824342871002131988328403020424616122640270076620991574262678890661663704100211907364642914903487724427446050810411405309772901000195238386018552808287684546803609185878747836826178644593072390119162293529949793778378127276446845355154045907587541425818182862634365507122223634019400932723884126236529467052009308118988537211732872815217091017299588992178539227655092101421243116758391100910949123077193559175951209123638410866876121406764478370868676192222970522967406729001506413813303981064585915504160857992756426380218993928697811815723289800700421868650517572739998836738336071431225280867143770357170115309593689147622678013406155824386439754816318355132315985137852978469918057051700817729161065505303516095233442802507243875155975650809550559170133561683503220027168315271113577509297777326851556929164381840664966378374437259814482630447816143160871928973520324709659083321992145933885466822624539177436842253577767688169591679872594137952316382396581347357472653281453304654531873725798332053418081092674579091737548934539784117937503383597009948299983001522190056466514334465364295858331615808603009649132253557310484684918377836759042917024735850458664844260714889646216330140744712522167123245262366977048993852748044395055382861240867817940892764177915040265892426835302479185623876708908549026019012294121357334484270257381382349436798825968685182350853913587570036383529028789264392715288135139468147686507141040639057055835713677324402629727681855479134629391169448082664789816642332674862272359200499046172455299396558733283767331842189198732386742509398157728549459733602715160976204846654504489072077430959487720819951985498758746697067765646572426035834723818024507524990132365652544128518597991801985722795552481957149041586813906399786919822282765756934461312937432257406939173339433843788553090880604821252900895555569539155657838730003027344300984771098887639017652357485011740931568883246275082261332210448937032611962015297900664994331658611434284073923401374875113434163421050801762852733977220529832079424214673445118667281900944872791795821340257964272341071911946749870887951458200519760544268201484128159416065886568778593754606899604574670226628505266585137024022950827596324240639590785808373067049190709150224349200583444619083629453006982827253978070109643209735258983088859485994708016343670720658276881203892847804008056545809049746947313720858384327095804229184264298095104772108428196023012426358594393507645240673573665662834948032508932711581684468340013209974445999150663032629831735533282283810046851306369056068350134829841206726867501283488161275587283622727360559859951745319300925474498998845531271604938385347867088707755595362989706787403586739025662699152219113671147294614170285856143741608168584138142810464199573393322164086096457764855522587185729779135347358166776430923325444115195881162071523588506528630139667365000218758875026170264735807320775982887974909567408295270073305201957914051606582522572965546517063665184316964383169657594238728541518124433482623031162295018206036471562178037029986172040694770316977250551329625854636976077017680213565046789745423843631581809848125502037216887861097531279608386595748700778936149209391831594922917974018372139219293643227295087041136502331483965276106583671460946891828525829548956358518506382328131840005048419405012246370569571611386040165044781560409486355922560781750187986006804463828551283011079051364102750969720748713952259380519642411907943267208879940746307772965726316534055397799773405470032735007199398633929768493954322424673032033239274170577157489012450868168336949483593515883510439553526211758011476013697362323228978731555072119528690773657923094759075890803710116389653690798719841162575537112634914701604324382132616508850158444820876508550468377852013032176726250064638152623694176169806875867851043469132727878311492603814106081450267978805987973138892800330655499087559097868496579590059506819805927030120240920130376094265630085900222383132418710503339633005241092434629775292580902458495460432853108678151046765945559578115204988726786491225711000051737136533477445863673165831974027339756745548199566659246508393783841183322194692299597779327908067997453621219042285169892874068624423070025137096728894284845063186325863482232964244487662267136387403349172703004364944786601941999851246453060801899237480301440901143839003915993921868348329498287271403809745939668868528908601632596899364806440660115215963249282998703974384487409443254092148933330104045217525340896072051735947390409355221903866872543854683845107023908545023815493190800091034203882112080419779727233336977832949117603527283670571512370670748754530389682136751588978253362886957778397199050884242133557392146944568046252206329618966479803807149564329896894110123652307103547767977319576825038416944326900835812005007898212674582364355156509135000524144082205954389824359857472212931541989231681662980640629985978360723223610724564050082798924915821826214501098322744321574774706983842190605102875931841105502185796531383269010534627890694564111385121617584181524714491609591805274834168491706517056286191157692744960473320586961286398433017959749068129667712872034114323443553873055557626317267365501402062941976008283252675540584513109209001651234700881069809349761470686750904504712565957897707779677905844167303999515004556336266141181044191083832314962326490618415269960587302948622794352390543956304933580248607735080108731940779839861172100781611831173819054542225753949450481307853111445998631142009558675835536683567786371659111367854668243347997621991289283652909422955189116803333897089574666023612699130218353238283188317485157509935312764108031437367953417962271646490551601219955264325140393921302870510038398585115426634283855035478712195463253095916218053145221491883065648550768037213677934175825281067327986715813011897869624470778750157219101406262913004156454607978890503642714672468502723654154840025059215511577278916158754616065610049514927919972641511312755289710483936460380439528902180809294958239485637612741482593518649289540803685142742230090267703151832480144653867194505824466498391243543426908541244417517222558128135659532127250407272113716788748003725307358279744662849835618216903707396682152984291501175222581549758941999606553373419273837072376936926948018167009483785171382329792528501477993211172743919869645107248982144665344664737351149630895207238313444432394233365939190092834380057885594940443887808082811357156033506453964366025459526127024025177470346788254650722767847038862887913322057156735085526260225191271396433166000807666109302244882994892687419496396383549103790488706574726490073566788655998457230621941471528451648754982439318183977620267937107966507191796274152849558493755266593364257097319697259798898533476180759848528063430103069721207045052801630067488691386508149227320130882098977390661459914428572190581554468681282104229841077455753057731529483776204508335941075758564158661055886866540664604430199889930260570608269837860136624934374523707587238661206177742451026947650231925145921509644269959831701810541742865286167542441255004101126435185656997922257898265375565110537902836287772800049111656446516570659032818164972709686819056627159298834904266081540710831883466369455582265334246345902760551467487491000

Which is 23*33*53*73*113*133*173*193*233*293*311*371*411*431*471*531*591*611*671*711*735*792*834*891*971*1011*1031*1071*1091*1131*1271*1311*1371*1393*1496*1514*1572*1634*1674*1734*1794*1814*1914*1934*1974*1994*2111*2231*2271*2291*2331*2391*2411*2511*2571*2631*2695*2712*2773*2811*2831*2931*3071*3113*3131*3171*3311*3371*3473*3491*3531*3591*3671*3733*3791*3831*3891*3971*4014*4094*4194*4214*4316*4331*4391*4431*4491*4571*4611*4631*4671*4795*4872*4913*4993*5033*5091*5211*5231*5411*5471*5571*5631*5691*5713*5771*5871*5931*5991*6011*6071*6131*6171*6194*6314*6414*6434*6476*6531*6591*6611*6731*6775*6832*6913*7013*7093*7193*7271*7331*7391*7431*7514*7574*7614*7694*7736*7871*7971*8091*8111*8211*8231*8271*8291*8391*8531*8573*8592*8632*8772*8812*8832*8872*9072*9112*9193*9291*9371*9411*9471*9533*9673*9713*9773*9833*9913*9973*10095*10134*10194*10214*10314*10331*10391*10491*10513*10611*10633*10691*10871*10914*10934*10975*11033*11093*11173*11233*11295*11515*11532*11633*11711*11813*11871*11934*12014*12136*12173*12233*12295*12312*12374*12494*12591*12773*12793*12836*12894*12915*12973*13011*13031*13071*13191*13211*13271*13611*13671*13731*13811*13995*14092*14233*14273*14291*14333*14391*14474*14514*14534*14596*14714*14815*14833*14873*14893*14935*14992*15114*15234*15314*15432*15495*15533*15596*15673*15713*15793*15833*15975*16014*16075*16093*16136*16193*16215*16272*16372*16572*16632*16672*16692*16932*16972*16992*17092*17213*17233*17336*17414*17471*17531*17591*17771*17831*17871*17895*18012*18114*18231*18311*18471*18611*18671*18711*18731*18771*18793*18896*19014*19074*19135*19314*19332*19493*19515*19732*19793*19872*19934*19976*19996*20033*20112*20173*20273*20293*20395*20533*20636*20691*20815*20834*20876*20894*20994*21115*21132*21293*21313*21373*21415*21433*21536*21614*21791*22035*22074*22136*22214*22374*22396*22434*22513*22673*22696*22734*22814*22876*22934*22971*23093*23113*23335*23392*23413*23471*23514*23574*23711*23773*23816*23833*23895*23932*23994*24111*24173*24236*24374*24414*24474*24594*24674*24736*24773*25033*25215*25312*25394*25434*25491*25513*25573*25796*25914*25934*26096*26173*26215*26332*26476*26573*26593*26633*26713*26773*26833*26875*26893*26936*26994*27075*27117*27135*27192*27296*27314*27416*27494*27534*27674*27774*27894*27914*27976*28013*28031*28194*28334*28375*28433*28516*28573*28613*28795*28874*28974*29034*29094*29174*29274*29394*29531*29571*29631*29691*29711*29991*30017*30111*30197*30232*30372*30412*30492*30612*30672*30792*30833*30893*31093*31193*31213*31373*31633*31673*31693*31816*31874*31915*32032*32096*32174*32215*32292*32516*32534*32574*32594*32714*32994*33014*33074*33134*33194*33237*33293*33313*33432*33472*33592*33612*33712*33732*33897*33911*34071*34131*34331*34491*34571*34611*34631*34671*34691*34911*34991*35111*35177*35273*35292*35332*35392*35412*35477*35577*35594*35712*35812*35832*35937*36072*36132*36172*36232*36312*36372*36432*36597*36713*36733*36773*36913*36973*37013*37092*37193*37273*37333*37391*37614*37674*37694*37795*37933*37976*38033*38213*38235*38334*38474*38514*38534*38634*38774*38814*38894*39072*39117*39171*39193*39233*39293*39313*39433*39473*39673*39896*40013*40032*40074*40134*40194*40211*40274*40494*40514*40574*40734*40794*40914*40934*40997*41113*41273*41293*41332*41392*41532*41572*41592*41777*42014*42111*42177*42194*42294*42317*42413*42433*42532*42592*42612*42712*42737*42831*42891*42971*43277*43377*43393*43491*43571*43631*43737*43914*43971*44091*44211*44233*44411*44471*44511*44571*44631*44811*44833*44933*45075*45134*45174*45194*45234*45474*45497*45613*45673*45831*45911*45971*46031*46211*46371*46391*46437*46492*46517*46574*46634*46737*46793*46913*47033*47212*47232*47292*47332*47517*47594*47832*47872*47892*47932*47992*48012*48137*48172*48312*48612*48717*48774*48894*49037*49093*49193*49313*49331*49371*49431*49517*49574*49672*49692*49732*49872*49937*49991*50031*50091*50111*50211*50231*50391*50511*50591*50771*50811*50877*50997*51012*51072*51132*51192*51473*51531*51673*51713*51792*51896*51974*52094*52274*52314*52337*52374*52614*52737*52793*52813*52973*53033*53093*53233*53333*53472*53515*53813*53876*53933*53993*54075*54132*54174*54194*54314*54374*54414*54432*54492*54712*54772*54797*54834*55012*55032*55072*55192*55212*55272*55312*55577*55633*55692*55732*55812*55912*56232*56392*56412*56472*56512*56537*56574*56591*56691*56831*56891*56937*57014*57114*57177*57373*57413*57433*57491*57791*57831*57911*58017*58072*58137*58214*58277*58394*58434*58497*58513*58573*58612*58677*58693*58791*58817*58971*59031*59231*59271*59391*59531*59811*59871*60077*60112*60292*60372*60432*60472*60532*60672*60732*60792*60897*60914*61014*61134*61217*61313*61333*61432*61512*61632*61737*61973*61997*62034*62111*62171*62211*62297*62474*62574*62637*62693*62713*62773*62871*62991*63017*63114*63172*63232*63292*63377*63433*63531*63591*63611*63677*63737*63794*63894*63974*64217*64273*64493*64511*64691*64731*64811*64911*65211*65291*65471*65517*65533*65631*65697*65714*65774*65814*65997*66073*66193*66372*66532*66592*66612*66732*66792*66892*66912*67017*67033*67092*67192*67337*67372*67612*67632*67797*67811*67911*67931*68031*68231*68271*68297*68332*68412*68572*68632*68692*68712*68832*68997*69074*69111*69171*69471*69497*69591*69611*69671*69711*69773*69831*69911*69971*70011*70131*70191*70271*70391*70431*70571*70694*70794*71037*71094*71214*71277*71293*71513*71592*71772*71872*71932*72072*72112*72132*72192*72292*72372*72432*72473*72533*72833*72973*73071*73093*73213*73313*73333*73496*73514*73694*73934*74114*74174*74332*74516*74573*74593*74771*74814*74874*74894*74994*75074*75174*75234*75297*75373*75413*75471*75491*75591*75611*75731*75771*75831*75891*75911*76031*76071*76213*76393*76433*76493*76693*76733*76813*76876

brainfuck interpreter

3009330765799839859299293287038911685464257758581961980410743356778442897542571786470986350328338232357573234454489622598735148638966340695903929317189311434918430625624720376945988676436538623241092667951012964091398547863203284555683429872752175083383828300376076428254398477451149159542953275322220943008213600374141102856026516990254553234528550252789381966049569952027644653322814172401454629826049802483550549633687184075379947758834018020441212398031572865605496901417568908728648846726960536687517122656207549239082342451491628216458472471931471004104936819490564317115426479826267175835525724209944351725265108992008587371570547392198613368670235798430779975242968314962454975767764458204141284152826617914760610778610331438240186810391400980778151159612245016498844517998922924869939716049373876552145104460680077232939748904765774282836651057319829385096982484501573795896574722666107034747914759680089481712130134171341897386642911198628729173812774261129248379294766573050303249023477609608753039439380277019689913275763631604276447108842087180852401105925605759890406200612029197845328590150853736111019252492469426972545680902436555207796397828745469781830125773597086081872214664157487325125778502511540819526719592122956981864074462222490693673531380183679262816245432697597238881076839084125646165750639215783879698049459428918676602627382194479851369943546452714065419972640987488218216484497874272502786613681913225397340023601441945106336342001589119127594560348011701240292178459420770128157839087618198502589452159466518485146581134243185722824244401443010522499555971011812563099767290045074231987999608102749700393811733132314435295826754794888348151848175130804889755854686060693097228411694890050410320815148249662778396361416831089440103123373022273622434030908905592376962973264016087143804606176734094372106808338151639760439870549228306133708517680287832059380640929631072226800087737527730446728566081186848657339400355111793851186138805470225224350106693102512180138185151295075679025442722764624476529880614867512821496716259701468920058604123471883003546644862894267102810732441987192222330872384319528611956567665997843313504202121122294063477568377410153173846069387595425935544855446492931060568104752464422999013077805445773311237023269276961466106604577520321452476669584627899287331468358555357902437456563410148879136966014553057756512740919368507728281381945628241916027756857997745891062673410277918150207387824506202472125250775170810797649430432539065683866155386089361545387660751418788693570560871394624308031338985889725573472357996678746534102464588752937248300817485340517101577742828885706926938828373212385635490729893719365709321105244116540191423644319047710503352681148190623140016556945779933215072422158834398355571071054345661152577479564155278757580051304107797460042889809397534451761925756677372290403266413267271044170037750266973272485359023233096951548840549030820897900950290817216476565614512506577632357161415859399540006971123329288888114268589788312392619703801010218897292833328931211438096254374286824775731727988187234031353630664356243263441018719066984452441697881254246464876837296050398124641364447198605431337845415743263466500511875467395488809477207849724232045927960002923313558600137157079932636364306751743856584473694944840703342822124526478375693904643303746388883461184268499985901301249747818527373769092132937379729507444061602720637038293024553716924396721014758825105981184973769240975812775251667496473512804435024471290758087031025509454322095082982188004373301709971638575795335873554038668150735543676971886238251152030044743490509072823012623397932440314624220429556127448325127724331619362151458995126754112552771876392769651862234048753663799857377056602994624538858068198196646612673128431269797789007001511739090175878791044302880561150966202283286692865524984665625794847998379554567365061165597146511136763491058756962941415166350095693166605659419606852240162610589603070269320686754362325380734095158088945159118448756315053270739525093109491734821806505641139549510795697296125162285424691662315178576273080319929712560656763127167674545870229609377933200865958360930445616722955677087367250130569190376755430783644216571768631678622360639627466930499062718799614109518227989120521537095306562009520954676846123754522174441337967962704867434916984352556280550588821322075189078447905351567113228091859027746677755249851591511341000

It is made from dbfi.

It is 23*33*53*71*115*135*172*196*233*293*315*372*416*431*471*533*591*613*671*711*731*791*831*891*971*1015*1034*1071*1091*1131*1271*1313*1373*1391*1491*1514*1572*1636*1671*1731*1793*1813*1911*1933*1971*1993*2111*2231*2271*2291*2331*2395*2413*2511*2571*2633*2691*2711*2771*2811*2831*2931*3074*3114*3132*3176*3311*3373*3473*3493*3538*3594*3671*3731*3795*3835*3893*3975*4012*4093*4193*4216*4314*4335*4393*4433*4496*4574*4614*4632*4676*4794*4875*4914*4996*5034*5091*5213*5233*5415*5473*5576*5633*5695*5714*5771*5873*5932*5995*6015*6074*6131*6173*6192*6316*6413*6436*6474*6535*6595*6615*6732*6776*6834*6916*7011*7091*7194*7272*7335*7394*7431*7511*7571*7611*7691*7731*7871*7971*8091*8113*8215*8234*8272*8293*8392*8536*8573*8593*8636*8773*8813*8836*8876*9074*9114*9196*9294*9376*9414*9475*9535*9674*9716*9773*9835*9915*9973*10096*10133*10193*10215*10313*10333*10396*10491*10515*10614*10634*10696*10874*10915*10934*10976*11034*11091*11173*11233*11292*11516*11533*11635*11713*11816*11871*11935*12012*12133*12173*12236*12294*12314*12374*12494*12595*12775*12794*12834*12896*12914*12975*13014*13036*13071*13194*13214*13275*13611*13673*13731*13814*13994*14092*14235*14273*14292*14332*14393*14471*14514*14534*14592*14715*14813*14831*14874*14895*14933*14993*15111*15234*15314*15432*15496*15536*15596*15673*15715*15794*15831*15973*16012*16076*16094*16136*16191*16211*16273*16373*16572*16632*16673*16695*16933*16976*16993*17093*17215*17233*17333*17416*17476*17534*17594*17775*17833*17873*17891*18014*18115*18235*18314*18476*18614*18676*18713*18735*18775*18794*18894*19016*19074*19135*19314*19336*19491*19515*19732*19794*19871*19933*19973*19992*20035*20114*20174*20271*20293*20391*20531*20633*20692*20815*20834*20872*20893*20995*21114*21134*21291*21313*21373*21412*21436*21536*21616*21794*22035*22073*22131*22214*22372*22396*22433*22516*22673*22695*22733*22816*22873*22936*22973*23095*23113*23333*23396*23413*23473*23516*23574*23714*23775*23813*23833*23891*23933*23993*24111*24173*24233*24376*24414*24474*24595*24672*24733*24773*25033*25213*25313*25393*25433*25493*25516*25574*25794*25915*25933*26097*26173*26213*26333*26473*26573*26593*26633*26716*26774*26834*26875*26893*26932*26993*27073*27113*27133*27193*27296*27314*27414*27495*27533*27678*27773*27893*27913*27976*28014*28034*28195*28333*28371*28433*28516*28574*28614*28795*28871*28974*29034*29096*29174*29276

Turing completeness

This is obviously Turing complete since brainfuck is.

File Extension

The standard file extension is .mul

Interpreters

Python

The interpreter is by User:None1, it also includes conversion from the esolang to brainfuck, and from brainfuck to the esolang.

import sys
def bf(code):
    s1=[]
    s2=[]
    matches={}
    tape=[0]*1000000
    for i,j in enumerate(code):
        if j=='[':
            s1.append(i)
        if j==']':
            m=s1.pop()
            matches[m]=i
            matches[i]=m
    cp=0
    p=0
    while cp<len(code):
        if code[cp]=='+':
            tape[p]=(tape[p]+1)%256
        if code[cp]=='-':
            tape[p]=(tape[p]-1)%256
        if code[cp]==',':
            tape[p]=ord(sys.stdin.read(1))%256
        if code[cp]=='.':
            print(chr(tape[p]),end='')
        if code[cp]=='<':
            p-=1
        if code[cp]=='>':
            p+=1
        if code[cp]=='[':
            if not tape[p]:
                cp=matches[cp]
        if code[cp]==']':
            if tape[p]:
                cp=matches[cp]
        cp+=1
def bf2mul(bf):
    '''Generates the shortest possible Multiplicity program from a brainfuck program'''
    fuck=',+-><[].'
    primes=[2]
    result=1
    for i in bf:
        if i not in fuck:
            continue
        result*=primes[-1]**(fuck.index(i) if fuck.index(i) else 8)
        a=primes[-1]+1
        while 1:
            isprime=True
            for j in primes:
                if a%j==0:
                    isprime=False
                    break
            if isprime:
                break
            a+=1
        primes.append(a)
    return result
def mul2bf(mul):
    '''Converts a Multiplicity program to brainfuck'''
    factor=2
    result=''
    fuck=',+-><[].'
    while mul!=1:
        cnt=0
        while mul%factor==0:
            cnt+=1
            mul=mul//factor
        if cnt:
            result+=fuck[cnt%8]
        factor+=1
    return result
def intmul(mul):
    bf(mul2bf(mul))
num=int(input())
intmul(num)

External resources

  • Online interpreter, it takes the first line of input as the program, and the rest as input.