Omnimaga

General Discussion => Other Discussions => Math and Science => Topic started by: blue_bear_94 on May 10, 2012, 04:30:10 pm

Title: How would you solve this math problem?
Post by: blue_bear_94 on May 10, 2012, 04:30:10 pm
How would you solve this math problem?

Find the sum of the digits of the base-5 representation of 20122012.

By the way, I came up with this problem.
Title: Re: How would you solve this math problem?
Post by: Juju on May 10, 2012, 04:37:49 pm
Hm, 20122012 is a huge number, not sure every programming language would handle it.

Challenge accepted.
Title: Re: How would you solve this math problem?
Post by: lkj on May 10, 2012, 04:43:50 pm
It would be very easy in Python, but unfortunately I have to go to sleep now.
Title: Re: How would you solve this math problem?
Post by: AngelFish on May 10, 2012, 04:54:56 pm
19,112

EDIT: When in doubt, brute force with Mathematica.

Code: [Select]
Total[IntegerDigits[2012^2012, 5]]
I'm sure there's a nicer mathematical solution to this. I'm going to go find it.
Title: Re: How would you solve this math problem?
Post by: Juju on May 10, 2012, 04:58:46 pm
I get to 19112 with C# and bc.

Dammit, ninja'd.

Spoiler For 2012^2012:
79339321913706201344918542253529978726384267001115032900247765529088834426751292419339719593701042030488706862587642939454569490402221629535560003752101033735930781409635190062652518479183745796043560975865276103794913065259649354070088066567483333224286267333741973784851192915998551567961451752797039543624417835820719676208311412673063521416536716075498261223999859560803040605737339518187154126989156123975814308845447914315515493672044850491488200813790935675884643569134584350929265289508542365346050581936389922907558742461047087812591345586318603122957429274284248495209835827292667258280129406158344303713021631375352628515570311207609011797638423707691541981658929247414093851385558567188848660796799252761728103984100711417403446430078731003234893363922939459622151847939380669420038185171792928176725536515424575886854587832643478211479845878729690731963541868761620376215585054466922863231251801601639378005438513851995093584550037469111567301112190345175146470343977208156226352567220051095864866162153265840111370344158536232332716744571077813129667720598388207996970170417069839298598543721070847093131697171930009079923028525065229935291476089204017935818118433887487930509207008529016336715572771343933427470674344445959463686538460118331703139353991060568344888028572208448763522510073560668486786429550072899239482821756234242973560495347896128674478012167369310955293056318284064280430215711028989384310388836113882758714169357572452319295149841629270554625020262344076498164104256903633149630061111870182307282138008858512211404415133156958571534255303081679608812073747015511692266096495380406380157554050223084798416021992839555744698080421741563279403011448918160764123558343664847571287565330714336052788089168444146012143020226774510932432113734636413759931767638028739803706136697106878834732424336460541410617630876411495740895316895913011223666161546107753934375587771812731002727737889371509214873612130713982623158305239956928428298774253939788578853990719148490096496562573251129234395611049295474888356725558895157741200114303549072971271172475485298345792473681604820915505836102275629089939257081109290984711112521936963990773722242756821776116677773860667586225662248030302263016212506250843211630994495009594676181059528498709149307940567652441567128909352765961975349207070199153471026910775605688998810358732219882241143182604282712474049047043226828150204590134945328462557418100041852238954570808107784069011054847472753562168812035279631417711425370575482422676765480492514612059274910487291202942405634664878870514865040023199858590278913509595327066160708955773934930054203813490972772353313230753406109300696023494166119818206700203884601965010061146289992068630636172312631900011885228191211658335594363338399255781840674692727920029974900960188406345068041289611912113790245324893701200154216536595776762893748851079969055167859693692293941003359411749073260880131228307623871936798467583878291725672009524432461552888656107115233815893737459266418489892406645765494241216293080059570245087759181616778457403505163350533370975967222853957722917626307917027790755969575213016548462332842493271431137990438941432547471046681557561161447320656959478643723405558609699475561436777688113211590028823476161487423699778327820589674804630232349760566883977012557741081201767293773004261191462696373541029413758521761989046675756193755462491664161737461089786469179392559840401676253791610104090525359066320711004121024332561738986929205634720905290720399538157150807141156682105805259902888585953396275530408341160690997530571710155619248324964581683062643532150623746471406681222506245091327597152712092519689659503933135734408479545738073300280355472718527199741456168312111293997219912021457148249276520916000852922018147166386207319857119002592230122992680269784060102169630201055639794641822132035541975738972084821285023037523458187653822867556634787514082277406798715437796893120583559741145321788007756428526829820428616107250195767171944189435501030298826967840727134903987944138054771172682945634518555008606501122319934333486248722832377352832141437320118225663053118708637833031952113222612100547083524187580603221908090082589473905984928875094902904215458786429475879312069152423718228880046628764975193642845099987210187541783648038320218626799829390519637997556654087206764293465494108442490933980739849516074405840101744723571606890967550596145468871100427216548536083568720817671632918109907991775819382961960600909825613664834326900376545255406855196308868114478219326336840341953931987695938602369013155310823602090412109514895799861816924192749926089959835555017282201930512686939938902859072025289347862751619870748510723457982109744027860330048769166408820686488344614557077890727082446803092362855451298281897209720832663503534713194398229196996944167743143273739209918961989228224648430119509291183310976005444800216949781514649597619672956881936234521818210961284046359772287166166443036716984063895823360494450665697219115813617754717463426581701245994516551642117727920387807045553950443088276306356300896526987010370534384738534567418080884525083834265817741122550509762228570877883989376126781352797994390154636025024752410225800544784685745217843912303143190883342383994445424974708403208869028878793210817541425337953425685322919106695767421817567464147951327615151833726295054529929017530229612020883947436494344471159812596161506865386767773391406453884769729697110655175774784602370873024111519816261236669840329885418216324207156117378880985048279897762828725913214299558272711351095825599194808018031141390007837178998197699052208342997084479374486444149246055764865726636054413654012578718214636788114970002624540352969968844391807813936918682618970921861220298509316683720347340382189731092840834168067975769636356259457081234232027236710584922645810120569443039826343740560488578084264242406546639042282145587816074372949806772426373481041418052399653239577276164229829134717824497355509428747352837156118454223657124922350582558086402379535742703850646583332405290280548346412163845842966433200243949871711624409164160340844617502546020959550579776503673688117138161662790625478375041012022339259977460004419223359674484265806934521984115986397292328624532165505316137809013106093186286414948408346878547117562174365155077719407583696233678238165076117024183643184023869587123274366585211183956077248971089491586041481130295099983105200861347848629446517208329621423038141212913200701594072467775631614991556087531691431072001739120774738625870426684270470526102098026337508672897338046306805033012280164154278679125744836035283445105565613246283406795148933260640256
Spoiler For That in base 5:
221421423033241324344204244123434301212302141234411021234102214232430442333033120403341313130340420242031404423213432403123020010244332002000321403031131134142212233444202133403014230100430022410431342021414413102300323201021104030343323244212224044140210413023132342022022323342031412044203101420213221240100123220233030121221131242313003311414400134233324403412311010011332123044213042000344314234234004212004111114422030143421440121313003124304312240432422300221004112444314010303010443431332333411141443230440200230021210144314412234322400324141012440221401312423102330041110041402214332221442024400021404341433222123230420441443040242000440120123031201402414200413020230402224104214000040012212430232411421000310321432224000110223433000010040300133211441300032240314200102432411021034240210110324431432214024410204230342221330201232404022322322340430223302111220200214320020332404041044000141114131104122324134122121412221413244430100202223112244130121311434201112342210211324422234124120214322132202441304432403040134010210234430224111031320232042211443123100131140441202142342413322344340041012234334301220403041230300334140421240223314342244043142010411410201301340333041044323441422100200021004123210110113041441413042412203241304230132132002022231402104323104113412020021033312101114443204140001243243144223021232444413014311432414200104433222432103121334433124203030301404141034331122012301304043112222112444200321304012301244241224114343420413343133200320400004120012113224422343441442101244440013023211343301212010204303124304220323411002342022014102312031333243314312343041143402321011410013403223114004442121103232312200412430410010223424300423112023214321430321341230233104032241123122332121200314424004104342204301333131442424342041433231014234000111341241322312332244421210024144233321210124434133144111220302220330021230122031432301243204300411311240200242203014031241304130444221222032101443431231102111133210044244341424313223031403231411321434312304422234331202010132221342444244103334340314232233010321243024344304402140312443240412300430020434231421412041341121344111143413321334312232021303012344204143202211003300142014231204434424121201030113434021032342413132223104103312302302333431211222304233203401122010322110103200211320414014403241314104430413341240333421001303434311242141342321230101412140421242241402024234011143224312220003211302420331221442132401403313142102020320134401042323101133323402343023422141020112410410421300032401311441320142344032122431333322134411440301301031311412133430331110032242104401233232200333110134241101033331124343400140432000033334313342134022214010313042022230320334320434214320131112130344011322403443102413441342032022404304134014423010000444440234221340312022440201310420043112203010030104234043202341241223323022034102104214223321201212310002020313033044343441013010213204203231201333032400143144423044142314434204141011013133144202134302441022123404004221430340200011410322421040324301310112210214243100342320230332103204231401101302431422402132424243140302020003334301131133020103334333012344024431203010032133421343123411023214411021010243113423024300322021224214142442033131201000020342211041232310111200404413114103000030042303311421214440442003423111332412434421243442103022441220013010021224042240423111311444300203214413340432214324420211243021101244133123034013221024114222003442104231111100440324031421110241301014133134142034411410322102321124241223101142042132444341301234231103344222243232130110340111311013334313402023230302030444044123103443113040213040244001310334122031034402123030441024020130413200323210321141320234034231143224310102412101211211104243431231133224442120301011342244040302423043222421421202140210413320431343232002001441030143432004223443112401144434431223013204232241220333413402231012121014101243411301130103240131021123344004233104422443144044402043130001032112001400341013240114131231132101012121404314342113323010441400133244114422102334110103123021404212321110123443124324322010430420212140104412430200211213200414002030010332103023341012012102003323340301203110311224442002431411313420423304004402102443341012220222113114340144114031134312033230423413132021230124433111040443131334230431200300440233041120440102123342042034130324432300043410202340410221243043231020112022020131332402114023324344420133242331343002211022302314434341101321241011144413440414312434111142103100401334142131444101312112204030324310022204310204204234304014420244002223413104033103303020111000311441430031320303404021001303201013122020013040122122001423113132144212202311321040244340233034141410100130414021140114202114220332103244213123023301430010243431120100420332322043114413321414022124010203412102422034444141202241212214131140301223343311322423144343303423433240310322300203123311233434104343441312223133133020203044430110230300211220444110444023123214103003213310222040021422421311200314022331040420111033430344332420440414004242001003320111133113100413041414340133320332021424413412332111331202014322042112344220140123114130323040010004234123040404030330310034342043403101122121203123042200443141001432402333434401434103240021020042102303424044224241233143324421301322033301001231132320431431110243213210014413124202442023201404003223001141344301310030213114402442322212033424441401401040031433204022131442343023114440414134030333000342214242003442042401224441111413424103240204311421311430344034234213000034410243220231312013021414233303221114041442433203223310202013043414241333143144002212203131333440121122020323212311343324344123402212223321040322422313230102204402440334332124101222114211121214212010111344101324041223230041331023443142110423230332004330400331310422324243430424233344400242443211044044020141333120013124213320203223231312303443240320203400041223331013342032220243440444140403213314140431142242322233022122044400221203430222342414332303424223234220424203023020212042114424212042102442200112012312143002101312402210414121041002423221412033101132400233302440314011210030332040322101113343203321412132421420332402440444011432132442242004130344010144114103310041223041143432023040233101043012002114011130330412141323304443042104211410423043221430322040202340012431423312344424414231140120022103103004142110223223043014043342001233331003020303312001022014143141442212103130242002212034204313042000031042404321421123114131322441141414404211403214421134044204103430101222301230343124234240124221404413423430344142012221230324043213410240400311002214104421433103131343120114240301121040103113421044303221442011441412412023420423431204111330411103144444042131101104033200142244114044423201304022224043033213041324332010403242002131003404423411120010400222404144003232124403420003213330233142031311442103222232403044243434434214314034422311434112343020322014431321130320444222234003333401301344403120103314440422202140332404040131220212010142432042103112311242401441322144120234444103103214134242340203002331340111000144441241420003233320421021320023313042433023100044412333131332211323123031304320012303212441201043344121033204344211243002234141032043420032332343201244434241140313242402444044014303421241022311210134420232323213313224034231114231032032224111400330440311002230233412241340124133242113212311100044414444000214433423024211330043412102314412002041331203420423434132212211213313232003244202244322241432014110434233424021200400210141210120003133003410204330204200211131142413340443140112443401134300312322131112123431012122240103430324022002430112403342002223341044220334422334024244403031443110234300113042433321440243201112111141004333323114142333202421120311304433424230242244440243411420311423240042301034042331104324042031244322314411412020030301234022004434041134131411023014412111432142010032140240032403034314211010324301402004313031410200103222122044000214140234324034400042033010032023200141233000230040013321333343024410442303244231132124112311123332441022433102403024333132233300132214412230312030203440140020304312104001133401140103233032303344401220240304241442434142022121323043224320133113002111033133220243211013121424420002111203223421320110224242000403444032113042031420342204231432221341410334244020210224112130234020443320323001242341444332034113123240340321404440012401322230423003113202024043301130304412134033004013113431312212034042134414313244441444341103421012224243003440344133444244212431014341434224412004332040243144302402033433113410114111323204424431034221003030120111440042301204420030220314020031113211203421210321101404211142042233443433044212342012212042042413124114342004134102231102111222143044130003431302013040413124013230430044304042432342144421431013202111121130220440340203214143041242413004111402223404003132112120113413214033222110101201032403142224002032414114004034333401314134404112041400344203441230220343330204244131032334033042144011003131304211014142333200023400301404403200112000331301111114001103300421403312030340201011000430323411324014304042130141142434302200011222243123032010200413314402402134311320232214411002303043232122130421140133042033323434233240003411302314211404401042313001300031122410410414040031333002121304403131130142134333240314003102014412430313144130021420211413323341124333130034102444304442003131243330100030212002412313241404034301221014232112223301233143242043114004044242004000114110213423131033434323122341403014342044210302322124423412242212214204233213402040321203033043414401104242010220233340214312013330103234004403302401113313023402224132440340302240221342022133343244432423123002112230110304210442011
Spoiler For Code:
Code: (C#) [Select]
System.Numerics.BigInteger hugenumber = System.Numerics.BigInteger.Pow(2012, 2012);
// now type iconv=10;oconv=5 then the result of hugenumber in bc
string lolbase5number = "whatever you got in bc";
int TheAnswer = 0;
for (int i = 0; i < lolbase5number.Length; i++)
{
    TheAnswer += lolbase5number[i]-48;
}
// now output it
Title: Re: How would you solve this math problem?
Post by: blue_bear_94 on May 10, 2012, 10:16:07 pm
How would you do it without using a computer program, though?
Title: Re: How would you solve this math problem?
Post by: ZippyDee on May 10, 2012, 10:30:40 pm
long hand :D
Title: Re: How would you solve this math problem?
Post by: blue_bear_94 on May 10, 2012, 10:38:25 pm
There's got to be a shorter way...
Title: Re: How would you solve this math problem?
Post by: AngelFish on May 11, 2012, 12:11:38 am
Huh, it turns out this problem is highly related to a problem Xeda and I were working on AND a problem I was working on by myself awhile ago. Interesting...

EDIT: Also, there is almost certainly a reasonable way to do this by hand.
Title: Re: How would you solve this math problem?
Post by: willrandship on May 11, 2012, 12:13:36 am
Does it have to do with ISEF? and CERN?
Title: Re: How would you solve this math problem?
Post by: AngelFish on May 11, 2012, 12:14:50 am
What do ISEF and CERN have to do with anything?
Title: Re: How would you solve this math problem?
Post by: Juju on May 11, 2012, 12:16:21 am
Anyway, that would be a total pain doing it by hand.
Title: Re: How would you solve this math problem?
Post by: willrandship on May 11, 2012, 12:19:13 am
it's much easier if you choose bases that are powers of each other.