# Find zeros at the end of a factorial

• amcavoy

#### amcavoy

I found the following problem online, and can't seem to start it.

How many zeroes are at the end of $$4^{5^6}+6^{5^4}$$?

I know how to find zeros at the end of a factorial, but I can't do it with powers.

Any suggestions?

Thanks.

Can you determine whether the number is even or odd? :)

Here's my way of solving this problem. You notice:
$4 ^ 1 = 4$ (end in 4).
$4 ^ 2 = 16$ (end in 6).
$4 ^ 3 = 64$ (again end in 4).
So:
$4 ^ {\mbox{odd number}} = \mbox{end in 4}$.
$4 ^ {\mbox{even number}} = \mbox{end in 6}$.
And:
$6 ^ 1 = 6$
$6 ^ 2 = 36$
So
$6 ^ n = \mbox{end in 6}$
$$4 ^ {5 ^ 6} = 4 ^ {30}$$ ends in 6.
$$6 ^ {5 ^ 4} = 6 ^ {20}$$ ends in 6.
So the sum of the two numbers will end in 2 (6 + 6 = 12). Therefore no zero is at the end of the sum.
Viet Dao,

I'm afraid I don't know how to do this other than working it out mod 10n and finding the largest value of n that is 0 and all previous n are 0. Which is fairly easy because of the form you've given.

However you could just calculate it:

4^(5^6) + 6^(5^4) =

153944614141262623913273879351726654877004146478040953675501290931666416344673\
162922048997718878656251388096995348770256878010791519716137709510007643030990\
832588077039658894122039728328473866359036839235970280039634879462066801632572\
729420924101653655414723780280921091278074796755258335859504782064655246931712\
918456461586050286870069468495571481695163643125308527868060286635894885529429\
974182028861526008685465369709175717574932332538471385315173938915091872235024\
411167422929710176059495933994479125880767431366935908442708080795945972525035\
741432554229901066996676513348065590960707933498573718488257550429863904837918\
167046726607380568505145064003767700240861127132930222942005091314944891939965\
913077984053753221962478039654593043075857361567394025104165105004239270622408\
425155246520727916120220003260422372248149817896245485275215252851858246200426\
575791355542504329827284179827901176926325130009384722239384954122257072123977\
369289509887018781418721054844994028161142932561985483542657075417897613128253\
732099927984976954153773173311696357033770864860020859320836342711460413208279\
922151346326800679654576996079807618658140384220671762588589974640836354391118\
999270966267140693068278359877972053575133326252471182205677172265395938530805\
237701334445919031981117367845810568898086261117225771972589232068574563621699\
752121400241211067509643574038185712380453032226716464350779645064113261118483\
471046739143072832612074440644260906773322423197771220268542846919408400573268\
680913389350227798334318477179942197041465236256811232766709437147824207886347\
384373494019983229523780750230358483277304277687199533614957823843090143034353\
137158048164191894387601121404931112605992031306596777631231014123926447242581\
803749110749801821528777124398539434587614841325536650535360289474337111310725\
980771023688786478236390255063580879425876639596315795524771654497620425140613\
212151057152108477282795577263596726575772479666225091781216658267567442716753\
977164593963434783629467700520243266866748850068644193843999600221151171679885\
823696811080891474595832371644016621422563732741822561276942999838140494949895\
422873761804162880326182795836313843546396656197232863742991063214942001526287\
776706611899675952525817943878194150341082362709562746318368116091374363759731\
273504964985085812340426398803394535511709736438422070158659752734160441021332\
743926036637327027641291063652618056212452113848780155523500199777149838211343\
414178937226719932750625994603217067316298300108803310769834903973291981793957\
540177923827616043940850471078773920988212950173119200106696282720826713693134\
897764995677977168751319759191898731791991380161363965004048535914944877448406\
270016199339266056759925704686973178252019444531033300508680475962260175319630\
574216889450425488131743611170010881849326705379687030058278334358943041296971\
931276631488457938632676025943096316350148384953101434517819754337102576396497\
106671955300902806771630211445430338537331621609794880047450989862745910086669\
881973669816833382908837221692957997176400548410474314602098047191151554568553\
422487495037816300150682607734430829150534437430985813165785172711506143640188\
135116598863814844171925670720745103770096477357660588663362064924568273659588\
296946873402059852016332190214795079235573362896093057959666187562227202448342\
866793251614522148072826004479813311589665983154511532372707895220903960250376\
853869367289934367324909152952817342112457704143287286387944242691981148289170\
469877005064592511517579614510414228703653151310359745137812853476331638040601\
480009572457354163856964819221364952413473254008542743440952369199921532070721\
145376661963905590717682274401987291932026332730383035421582326413897825455637\
770386349315945489389823221758436748243151417651763656964419874488510171861332\
097723878167497509692393601745514412996590011715773823885779421341903803444823\
088222397422724818100393717915061115101585811910904572188074378990497530294138\
070405361341637476380743913271696177802524782552051783679448734449035725575818\
174674474178471190865589413210838618302093695140431504403481712047787607752575\
460486567869744348128898853277424452706247218896556819761092287378856204305287\
798114101026708979478453303636500414941835109324968955882757268127012550191149\
981362716965889457019553798645008465127243158910050883507636590618760871646980\
185433941917443748505657771217363409304851552166400324782957797879202612743409\
981792906601169914081001811894371616631779010463303232669601661996409824659462\
970731124771967758468375199792072083212628076631227796025119611534424903265409\
834432317932110282172019962648664726085269540291306050132390367898161111653926\
221672492126233986906837722594294128653297611143097849468796530148815585895774\
208620547874236919124961935598664181714905878425766570837549087139100987030922\
886669204072985567835312772708483600688163012354578054703237152880905318631705\
743010983576539686646887213013627090321212307941533532001054533651219642233160\
104783994550044786570803817939668986277128477679500866611604136622082015227895\
582518782802523186170230654592548069478647066807031010992309705032253417605914\
557718522233435715434999800467223514966779093434020599511910976971514157605670\
946888641697172352334896675177555280092395542686544301338771659473019408154627\
625578965709286390052213917205064208069464158661694743891169482896887892038633\
800184769772823281467539760050509915222761047246987725565382572216596651272198\
314118494512409627941944943730930967840934216004846071171405271538526664813271\
907001374929523852951468277859615006070137314794402755880631474181392339629855\
620876279428278529361185927921106726709781265301808609509390287145505355281932\
036749871337088072720920955518545130899833424122569373538089296171812085128671\
961082244633791180028285787291642814523608847557623779534364600778363227950448\
022439201479227698887595732466332163547291030603625096736355043653059516636009\
201520808886226868190247619632817336883538757870414100118886349303032221097792\
169428369284469254268298228023266912535621728659941377361866645021413659574035\
141618737200876374231024629897078688172345999765283751135186085135951381652773\
997229259821402643005417602710728638062377816400101305498302631991704332892515\
273362975439386585321761342434235826825512067705871015000969042217257802789601\
309959906662745883587863447041416252538124855798802576885932526760727493957919\
574083493907104530788101365039842638561822319472217097954446872865587782312224\
731154360103404937865864821898669817072476661344924647580932306390088509421804\
889498024406925674920525219246882149728605165438202261115562091162520373087913\
656465255725903097665691280287322132068172748947708299337373797811410477262233\
776534030820350055826160678649232933795089253365097728880059770612355848661120\
644882496785583715375944707123972614760813149457806549652851572137210828435133\
042519899306642767161958532774181785118129130060688289964912876357255392409390\
541948611044763621660935471857620379944825645838678707767649012791927494841722\
640418509678142806391370185751153247155076497925522110321726506545042216017357\
434898628943657492019159744176155680461005777644733396559545495088489215021163\
895630389659973650993662815184491246758628353416543773394076437405051745929030\
104108940950719069903249674915863819903954061456706270844667456442281829934580\
210957078651049365070366484576139398298515937549277552508128799562042375208675\
243066989945163610542464371827362728825544167306579304462988328085359671706863\
938844745184820493483637676757829175117161652500838274916670399592911503502443\
637207734705175034781959832298151933344602367663937805659897538658400047206259\
469697544134891884281037986964945577025523717633132664512536685013509888688351\
146040559960207346238007902625009882643234899097484829798615071047193356470609\
673619053157805282983369032331149923803044968725576842312230901770889152307323\
156270368878509881139566970165506788445039086437438749083269967110184805767783\
570644795703465558527226267799833727834802187264951919693328724117749963987211\
946777078203944691870327342781685322366458600362867746995659715812661686151699\
333506657201321738662155591956148972236739430965505515959567133892414738035355\
994389860880043329277441350819692281094064868363633486936982473383244250889524\
370106535796424794785012343775531046745910210974490204489043497559612120795111\
033880124295557050420885255505060705173862505838721481876297894868047525350951\
427719768706528928847842786612756408488276033650975290266550107043717720598580\
731564094877554029215743778638210139969375699495435897323611816793692200881296\
119042981288114604377321864834303266855165339869453089802733020350828928619396\
097717782657839160819593622357439716332667091480643196302242519747657707965201\
118476297260593863534995205142805143102987568281712104241468352790526785789456\
962798115546027188632509320518146342914826945904532184995674827315471112548808\
878562768432772424454230753046167984957900067442357577838009679140076976845743\
185103222649329842292710930375176486894489803318509284835941053871651931099567\
160946433622242788063383047861891608283021363382787469198604712979009335135876\
434921080446026770056318097114170702234830101900960237616730419386609562929954\
942305624595012190752742643714236599103735994908397741902648790350879348228446\
202738132525942352267937984649811629116297484444309141516625002702211642375924\
425554895262903770658131079725786757988124605685400501884407066360470472196896\
939250351868656941828080273920275853921484800000

Zurtex said:
I'm afraid I don't know how to do this other than working it out mod 10n and finding the largest value of n that is 0 and all previous n are 0. Which is fairly easy because of the form you've given.

However you could just calculate it:

4^(5^6) + 6^(5^4) =
Your answer differs from that of Viet Dao, who rearranged the problem as (4^5)^6 + (6^5)^4. It seems to depend upon which interpetation is correct. Is it the same in every country? Also, I am not sure which is correct in the USA. I understand that multiplications and divisions are carried out from the left to the right. For instance 24/3*6 = 8*6 = 48. At first I thought it be the same for powers. But then I found that reiterated powers are evaluated from the right as in your post. See http://en.wikipedia.org/wiki/Order_of_operations . I am not sure whether this convention is international or not.

Last edited:
ramsey2879 said:
Your answer differs from that of Viet Dao, who rearranged the problem as (4^5)^6 + (6^5)^4. It seems to depend upon which interpetation is correct. Is it the same in every country? Also, I am not sure which is correct in the USA. I understand that multiplications and divisions are carried out from the left to the right. For instance 24/3*6 = 8*6 = 48. At first I thought it be the same for powers. But then I found that reiterated powers are evaluated from the right as in your post. See http://en.wikipedia.org/wiki/Order_of_operations . I am not sure whether this convention is international or not.
There is no convention; there is no right in the USA compared to anywhere else. You're just supposed to put parenthesis around the binary operators that are non-associative.

Quote the original post and look at the LaTeX, you will see my interpretation of it is correct.

Zurtex said:
There is no convention; there is no right in the USA compared to anywhere else. You're just supposed to put parenthesis around the binary operators that are non-associative.

Quote the original post and look at the LaTeX, you will see my interpretation of it is correct.
Then there is a problem with LaTeX since I tried writing $$4^{5^6}$$ three different ways: 4^5^6, {4^5}^6, and 4^{5^6}; each within the LaTeX coding operators of course. The first gives the same result as 4^56 and the latter two forms give the same result for either choice. How would you add the parenthesis to the printed form in LaTeX?

Last edited:
ramsey2879 said:
Then there is a problem with LaTeX since I tried writing $$4^{5^6}$$ three different ways: 4^5^6, {4^5}^6, and 4^{5^6}; each within the LaTeX coding operators of course. The first gives the same result as 4^56 and the latter two forms give the same result for either choice. How would you add the parenthesis to the printed form in LaTeX?
There isn't a problem with LaTeX, "4^5^6" is just really bad use of it. You could do either:

$$\left( 4^5 \right)^6$$

Or:

$$4^{ \left( 5^6 \right) }$$

Last edited:
Zurtex said:
There is no convention; there is no right in the USA compared to anywhere else. You're just supposed to put parenthesis around the binary operators that are non-associative.

Quote the original post and look at the LaTeX, you will see my interpretation of it is correct.

Of course there's a convention; exponentiation is right-associative. Implicitly, 2^3^4 should be interpreted as 2^(3^4). Of course, that still agrees with your interpretation.

master_coda said:
Of course there's a convention; exponentiation is right-associative. Implicitly, 2^3^4 should be interpreted as 2^(3^4). Of course, that still agrees with your interpretation.
Really? That's a convention? That's what I intuitively thought, maybe I just noticed it so many times and it came to me without thinking.

Zurtex said:
Really? That's a convention? That's what I intuitively thought, maybe I just noticed it so many times and it came to me without thinking.

Yes; it's even mentioned on the wikipedia page that ramsey2879 was referencing (and on the associativity page as well). It doesn't seem to be as well known as most other such conventions, probably because expressions like a^b^c don't occur all that often.

Zurtex said:
However you could just calculate it:

4^(5^6) + 6^(5^4) = 153...3920275853921484800000

Zurtex, what software did you use to get this answer, because it seems right that the answer would end in a two, as per Viet Dao's reply? Yet, your software has it ending in five zeros! To help validate your answer, calculate the two parts before you add them, inspect the last digits on each, and see if a rounding error happens before or after the final additon.

Last edited:
SteveRives said:
Zurtex, what software did you use to get this answer, because it seems right that the answer would end in a two, as per Viet Dao's reply? Yet, your software has it ending in five zeros! To help validate your answer, calculate the two parts before you add them, inspect the last digits on each, and see if a rounding error happens before or after the final additon.

Viet Dao is answering a different question- he interpreted the stacked exponentiation in a way different from the standard.

You can check by hand that you get 5 zeros at the end. There's clearly enough 2's to make it divisible by 10^5, as it's actually divisible by 2^(5^4), so it suffices to consider the equation mod powers of 5. You can simplify first by factoring out 2^(5^4), then see what you get mod 5, then mod 5^2, etc. until you don't get 0.

Steve,

Zurtex's answer is correct (I use muPAD). Viet Dao used a different interpretation of the exponents which I don't think the original poster intended.

SteveRives said:
Zurtex, what software did you use to get this answer, because it seems right that the answer would end in a two, as per Viet Dao's reply? Yet, your software has it ending in five zeros! To help validate your answer, calculate the two parts before you add them, inspect the last digits on each, and see if a rounding error happens before or after the final additon.

VietDao29 was interpreting the numbers differently than Zurtex; so they got different results.

(4^5)^6 + (6^5)^4 => no zeros
4^(5^6) + 6^(5^4) => five zeros

Someone else already did point out that the answers are different depending on your interpretation of a^b^c. For what it's worth, I Zurtex's interpretation is the correct one, unless the original poster did not properly post the expression.

I used Mathematica to calculate the number.

But to just answer the question, you could probably do that by hand as long as you could work out 5^6 and 5^4 in Binary form.