You are invited to Log in or Register a free Frihost Account!

# first two digit(unit and ten) of (1234)^4321 ?

kmr_mukund
how we find first two digit(unit and ten) of (1234)^4321 ? please give solution with accurate logic.
_AVG_
If we have any number of the form: 10a + 4
Then any even power of (10a + 4) is of the form: 10b + 6
And any odd power is of the same form: 10c + 4
Hence the unit digit of (1234)^4321 should be 4.

I cannot think of a way to find the tens digit at the moment.
Bikerman
The method is going to involve modular arithmetic methinks....
1234^4321 MOD 100
Then I suspect repeat squaring will do it....I'll scribble an attempt later if I get time/...
so far I have...
4321 = 1+32+64+128+4096 = 2^0 + 2^5+2^6+2^7+2^12
likeabreeze
Assume x = 1234^n MOD 100 = [1234^(n-1) MOD 100] * 34,
we can get:
n=1,x=34;
n=2,x=56;-----------------------------
n=3,x=4; -
n=4,x=36;-
n=5;x=24;-
n=6,x=16;-
n=7,x=44;---THIS IS A LOOP----
n=8,x=96;-
n=9,x=64;-
n=10,x=76;-
n=11.x=84;---------------------------
n=12,x=56;
so,when n=4321=432*10+1,
x=84
well, the method sounds pretty stupid, actually...
Bikerman
 likeabreeze wrote: Assume x = 1234^n MOD 100 = [1234^(n-1) MOD 100] * 34,

You will have to explain the logic of that - I don't see it. How do you get *34?
likeabreeze
Bikerman wrote:
 likeabreeze wrote: Assume x = 1234^n MOD 100 = [1234^(n-1) MOD 100] * 34,

You will have to explain the logic of that - I don't see it. How do you get *34?

1234^n MOD 100 = {1234*[1234^(n-1)]} MOD 100 = [1234 MOD 100] * [1234^(n-1) MOD 100] = [1234^(n-1) MOD 100] * 34
that is,
in X*Y=Z, (X,Y and Z are integer)
Z MOD 100 = (X MOD 100) * (Y MOD 100)
actually,
Z MOD 10^n = (X MOD 10^n) * (Y MOD 10^n), n>=0,integer
kelseymh
likeabreeze wrote:
Bikerman wrote:
 likeabreeze wrote: Assume x = 1234^n MOD 100 = [1234^(n-1) MOD 100] * 34,

You will have to explain the logic of that - I don't see it. How do you get *34?

1234^n MOD 100 = {1234*[1234^(n-1)]} MOD 100 = [1234 MOD 100] * [1234^(n-1) MOD 100] = [1234^(n-1) MOD 100] * 34
that is,
in X*Y=Z, (X,Y and Z are integer)
Z MOD 100 = (X MOD 100) * (Y MOD 100)
actually,
Z MOD 10^n = (X MOD 10^n) * (Y MOD 10^n), n>=0,integer

That is excellently done. I especially like both the use of induction and the loop collapse. Bikerman -- the only reason the '34' needs to be factored out is because it doesn't appear as part of the loop, and so has to be taken into account separately.
jmraker
Using an arbitrary precision calculator the first 2 numbers are 37 when you enter (1234)^4321
It multiplies 1234 by 1234 4321 times, 1234*1234*1234*1234*1234... which is a really huge number with 13,358 digits.
http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

I used "bc" http://www.gnu.org/software/bc/ in cygwin http://cygwin.org/

 Quote: 37394269330775836378144082067445940833817779182500620289750496262172\ 70498075614775690770519781711635993849355803305197779739160929508471\ 00869331505024837412772901463154480790076812732928912961768390318490\ 39937377157259218056377357970365430720599399559504654935257725850826\ 82978874228385358083604461741869749184396692020059516065387723204296\ 07958390909190604415036287266293055240742751198958487522305440565722\ 60350974704629925993695420558961660235415038692547102065812771642161\ 36087793242925028699013928885975034251181779235536697743140973150033\ 74091842827301637396801071012725689519687663717947090341861636154101\ 70022183040212505261941778101555240632210621862497090517403704507004\ 24738028910893322824339678636670679947834822852634218880637988072596\ 05163538630316662199061681804019102344539227467098897945236046615723\ 04589825380973027344087013331138575722177091122683869402998982129830\ 43599337829690689621102480143195796713312437506474818559492555748860\ 89449670054210114431953147333826974640708179210943805571676458401688\ 34938293062344573061477641599447991974061908031247578215176023102741\ 11574382052201838769946391933055415118300482695881238354202519194541\ 05439736800158297309446918221546151523308722937012350348716332839713\ 44966843651998695820585168373042410395932227759298304642925315327079\ 97596779383723524446695883062334628812625536425643509688104506987877\ 92962039019156772633534602824959473035713850823417043441904524634001\ 34626682414778450428536656182353663657760163021888224455063814403483\ 96343925695951824747759536010591467882559599694088076839956810233315\ 68699441122705896439326233925830369017960595580391584500346624295049\ 76333261580691621940700959906636339335023495344742878249553347396570\ 50295415137393667184187555820701440929898698506965541305852886855414\ 48547613937362324181536912196986968480094827484710601140152171093427\ 10682751865543790461079416540256586070726844797831801354039189948063\ 95396456712686826965882877501343786852856109037249320456847734119884\ 66234133652251816421181536348416736040484987289639119946550578186160\ 78010231768063978663698972336202990846926016444301221877805331475606\ 30491809407933368782718822968061351743385662926260655164906311749999\ 58863639770855363268272969372426400868678702911094594823166888261867\ 43327295386744832403349152505496063236780716584616090232200382770603\ 48318279338672813596910796169672859565972485547432704675370790787593\ 58071834473778577297703095365274680500114962606187188073110104442325\ 88491002540583152526879780650426466732467941415676385174550805599774\ 99959014458365483224202723285305179663476488762911758431496875353960\ 20065575936476852807999690079510605296347792967335055807933121137890\ 81388701239227864771055187495101128240213367250326174027511027340135\ 23068015671949266155823601326664331894244013090784247473580657128196\ 67514991109940273150501639030585335651889608668919738288158539727493\ 29431678205997353856600624489691454343019525914574753221466675676705\ 30249243857374814136081317082392772663091848678859497616300436784489\ 39529452784296256451794853082069379962983504088261660376501344869998\ 58054240324943189738622504757508344185435638972092642621163852500279\ 26680427346627179704644686330056643479947819683192906283831298461314\ 09848066906212117378220749188326494571977775526860003890306340636254\ 04265227764625931339877807537227999128486851568761329927534065143643\ 34054133502237721871544268291557129109748009668419087308968182228830\ 02151741777675357770445270491212524703429722843050930747949698737174\ 34978004730642371898939698016671943433739469855243808429966580824282\ 99739498400969121105033408280490582262200966796659062085795203863588\ 72332055787056850321234754270655936341970785876628601194535979669097\ 24327231889455721304404862690001644910472835455862346482176681070861\ 10744307478906961358937801992910061981567811847518146800659867634578\ 23362288095284256388619544226960180259092811682328377544722429126310\ 86939927847537573049671222608232939744547355014615512839573884197700\ 16163551220489679772273358696646952355861150075068739029983222513106\ 94378473964430999682587017099427475082200210220850639709870478087606\ 21581716953681709242163514502770999874807561237421502497158774348086\ 28242311906908893508837896372744759457244711742179635430403966172046\ 74941699472996297018458178003777449925175460692528517020654307208277\ 89071085880230413856644599362873590583084218047565163080558890937705\ 40558257353697379694636693452467703043017412549496009285130803621741\ 66936241840302994145673649917923416796653273896618589813035828348679\ 43598978647364069997438729775072645524423784465411982309928812596999\ 59787293674130619676816621842993423325142930050979793218611465629710\ 22314182036943795202264268301117710719060480003441007232511349737223\ 35249405858816938129584259301405612868359768910023985242294578708516\ 14774295230187670799447893898137185986226718380271751830522219011120\ 57781601752006824413071644318786905354074132395655756350904845640606\ 27542661146717864099030612026441672170793566878029507181143224922550\ 99035084623638623574843789272136191362630659301718093205514032040557\ 22261055459125625443389058555568722843295235510710621694142055867327\ 12709329571183767930937929603965131387452829913299580927114849406199\ 44653577291270554166985318033833614492923130694276997507946893111684\ 61794892098426464567789948118735068142817785742552291150500771737047\ 09940649954318749138113389395281239665618921012410970502659786534088\ 93405985927995471003625811184119104400054747911051591629497412882414\ 19574702655633695820007691082218761392082430717466326951627269125155\ 48379516114768112488717201112010884628085345421725033910139747866991\ 51502503169525939676104134963646937951697994566638711508384462101895\ 01173590301485036920149407483884209650130298975591071636831522015778\ 19802113666285847650449808017689941784004038226926363211327092770834\ 59714007358974854625838757356212926336752246489989156039337142763564\ 60006401157269029564429868560915548049254770811122645074364808490248\ 34527735789870143641334370161235284890413112238360410545162337066698\ 35478427991203728258310829242340359447532840394317094859919282936328\ 77763980283828425345036451548266124998878293266991425067558633072018\ 70014802932370281848987245768924739080455699068102464564106281975832\ 39159790610052682085776190923745070507648227271610331965033785458804\ 66012611591581846834793476750720102099775034837576827085576540084078\ 91120041018876351984479362728084559071887986396163117527555016897673\ 33072127737474679193678231210650279303344071789066352177235202270934\ 29299561682670631608350427834987131841989841611258743534849871535858\ 36726002677196520245931593853957104438060247583569839961095751707293\ 17311729374450516726783907776032354518077904697563154966780331534053\ 40151980689065587131803914547185902087484643624929302262270016133216\ 94097341344967476825387210425041463718926775926254799572616362644202\ 22142769282507857140810762113370069228026740239899891439837987439092\ 01486301909801794232832214860458887508516429753068180842168618965591\ 01075199744433919882538220482012055382718241916876172742546786557722\ 57721762329271078173261491450431852982466066215781716853432833502948\ 05444760447209080084797755870149837856986456775058946122434905877952\ 32211945273104004128290220714468468804001835763721120358639117357614\ 26028842342385962614689723553332265244299890429356387097195436142361\ 51769613168921455339144896745784173673680142679744535396076488075779\ 61171184131660232185997358701801162450516631239339528958250014327058\ 81200899513186964981384265995524039677484922645080601892935649921208\ 66067546550981004473720290362920060339153899414019528918252411945275\ 66030633714040857223065189832609608267607390859157528616438365618963\ 74336074392217347361340892002125006639435528763403705058945689834989\ 34525167019828703220537201161670336860417761935226402985468051439533\ 08487563988822813803578256127462364861897791271685985154835071673888\ 51136037034086241776703613627427636172123833581606942465454924254558\ 60035937075854730860992911983991221833295521054183211704643492537498\ 65921747350902847629318154441837715653788066875518506729568988676367\ 73101581025392572622456338744491474653607752188730551142787346460657\ 92724562735775859180233252746627385104503077729879378161366044069427\ 92787935761556427050084874232182721620708066835075121787807569428379\ 92584440890363779517104500216700214792939863181023644437605573862628\ 84620395357915286018292339826072215189750985816187782651061223803834\ 57862129293340853643392897166912177916196747544669105745380797843617\ 48397721954010988374847935652105405009552242280697907270076218859813\ 35837013619957805415728209079078707790376549889169111323856232496200\ 31756264962625338478842956293115432323710581623520729364883029741431\ 50880942673029454657737956270302742665828158793737807412444478510365\ 09209302460689733241497625068740536512285550176864885940557774505466\ 14597773344136178749387864223058674944277638872784525689858112271038\ 57204825346877113646289863590676852621987007022889783258712635495179\ 31614362750136538382050369808109418622223796425421502504565166140677\ 49105476374964726785004170679704188732883882143224957776461082761466\ 16747004021417308810190844622233043217952898721218088220536005101806\ 34319267024909921984429443367656632197436304958064543837228231710981\ 58944538209599040283993666555115930022425171540772459009936157245555\ 00241380415028667384757207200830275438067785261494922846715439158216\ 50881252345209254326436097166095674572828308118721252175045837321689\ 73111577645714708595489128193629179116532826880445426210011158291148\ 33837563375601459161219959642758676571617107971390214292375867122590\ 35598746736945144202512154735894202247773608720467428937106772603551\ 70044071799987963523823598120431324732665424161965355491341339267454\ 81085755392324184804287309565748465093982932274844896574579039920227\ 41450861358529101103549639157700768937823641082934732723311318366736\ 42473566802798019156194540047852394555920325889866827000894808787196\ 16445352453757114607857253379869652297341383940825995996364704264798\ 26148159881661074639928528991140891519016850050912979022492112446575\ 62468089404772666540042338410746320186251639151571205300628751506786\ 76111356672029815448931715632460460222387693546594668478788557942242\ 82661305596417925110481703983764847138954643193420394844805276225014\ 65078640411130357918596136091476817130742022270792470425883865714645\ 27775099637608403943895600074806501971123294583550896875533874693034\ 94642220327010848624082608634086963936611255197325285910112184181835\ 24713382699160369989296462239079135604290541219906383687970248049956\ 69897864371535901319578981766846699176221142542341897169703919569326\ 03997972390777821381538609108412447078093244300202247763142827572892\ 83816943475436465508127313282389262643644134977803978163744704407877\ 43331036798032253417592637367879670805599668689594264719255734414247\ 46597305376993331077018201026859546706801587236113109370285856458198\ 22687879655850192571335351570274973334262782331868745730938706296803\ 81319865759669278294858614282968092871127402482244934200100436800321\ 55714237580574367187010013899160632223717771113073325935351024464188\ 32090372670360411859631939206678536944268750242167493515598215477479\ 72269811683387288194052621515205974928500892918547705610278430607064\ 55346692618272513439375053819089512695656963448470431232000272855167\ 99878955320577000170839939315428526285606254035117299190861569118066\ 36802712829499378741453492072244826327845534478989000620183627326685\ 99460187829860423904282676040819494673494845081472922127571607008085\ 54524114649657564380276274530199231641290049214787084370957076506795\ 81604689884146757186322681143196483797878110548032697738176039742962\ 20940107625082644847038891437109442757472581495756567519223286967374\ 22627154170046195760533617798625917036065617026035368587996394492747\ 93770493181743677020218177863118823448891223662958915588265118559729\ 34577645935608346924142740985452177911752918830947364267955320053034\ 77731046174908501571595681573234628744381738103992458708166876963860\ 23904159934387691359013761690608651792333242831161541817700976175906\ 10885669638824573242968073877523226038216958790876547134939854462755\ 30995688264160853011271495904361241304381195607016751217480429903612\ 57822231341273454137220519792096716472148335922794604250530052915237\ 29446963290820806840576411995100682596173194587236582249335156716805\ 02598734227989813337485657420863332999804358799752191437415343146621\ 00490222316105555667367011686772896784814145800286480622522543379128\ 75584687619580927644838276112292687120265143840723287366180117151509\ 26406259234407022906882956185354473715779841295759889339868665044351\ 23687340411555670801404503235091044569677592054337610214505753473922\ 12655535529283135038981085054602622220522207720196365805602590514159\ 90548327116971683635658588384730019895785490222841990079289098454946\ 61154691339006542406306158035989239325599089771216242168239096806593\ 79744335995972702539624107277352971921873199514653344948627213345209\ 13261084998012166544509613355331767377363892279786083924971719335384\ 76529126222070229134375932470042214064998297535583481078377907579311\ 91716956197249069398101522761107258858545072131289329199868727892171\ 80010936080961290379878122484099568962558549576693077969843851019707\ 91859640292335413914412937297568436499650597346707482027850201678993\ 04407131681786194469495697713466300287576944671207241283919575311996\ 87771503037181179314528000994651699508203786060525536748416289624770\ 463642694767138159383160029184
likeabreeze
 likeabreeze wrote: 1234^n MOD 100 = {1234*[1234^(n-1)]} MOD 100 = [1234 MOD 100] * [1234^(n-1) MOD 100] = [1234^(n-1) MOD 100] * 34 that is, in X*Y=Z, (X,Y and Z are integer) Z MOD 100 = (X MOD 100) * (Y MOD 100) actually, Z MOD 10^n = (X MOD 10^n) * (Y MOD 10^n), n>=0,integer

there seems to be a little problem.
1234^n MOD 100 = [1234^(n-1) MOD 100] * 34
or
1234^n MOD 100 = {[1234^(n-1) MOD 100] * 34} MOD 100
???
and
it should be
Z MOD 10^n = {(X MOD 10^n) * (Y MOD 10^n)} MOD 10^n, n>=0,integer
I don't know if it's OK to write like that.(considering I learned this many years ago)
but the idea I want to get across is very simple----there is no need to get the exact product in order to get the first two digit of X*Y.
 jmraker wrote: Using an arbitrary precision calculator the first 2 numbers are 37 when you enter (1234)^4321