2

It is possible with $3^{3^{3^{3}}}$, from this algorithm (https://stackoverflow.com/questions/68797298/calculating-3333-very-large-exponent-how-did-wolfram-do-it).

However, being a large number, $3^{3^{3^{3^{3}}}}$ won't run using the same trick.

Most likely it's using the transform log(a^b) = b * log(a) to calculate log(3^3^3^3) = (3^3^3) log(3) = 7625597484987 * log(3), which works out to about 3638334640024.09968557 if you take logs base 10. You'll notice that the integer part of that gives you the number of digits, and if you take 10^0.09968557, you end up with 1.2580143 or so.

Also, Modular exponentiation also depends on the whole number, $3^{3^{3^{3}}}$ being too large, won't help calculate $3^{3^{3^{3^{3}}}}$.

EDIT: I can't apprehend Knuth's up-arrow notation. So what is $g_{1}$ or $3\uparrow\uparrow\uparrow\uparrow3$?

Polv
  • 139
  • Those numbers are too large to calculate the FIRST digits, with moduloar arithmetic and using some power tower properties, we can however calculate the LAST digits, even of Graham's number. The key is that power towers become soon "stationary" modulo some number. – Peter Aug 16 '21 at 08:10
  • And the second number in the bottom part is not just a power of the first, it is vastly larger. Do you know how Knut's uparrow's work ? – Peter Aug 16 '21 at 08:15
  • 2
    @Polv The leading digits of $3^{3^{3^{3^{3}}}}$ is easy with a few logarithms and enough accuracy, and WA can do it without issues. Multiple up-arrows is a whole different ball-game. $3\uparrow\uparrow\uparrow 3$ is a power-tower of roughly 7 billion 3's stacked on top of one another. – Arthur Aug 16 '21 at 08:25
  • 1
    @Arthur Apparent, maybe I am wrong, but Wolfram won't even try to calculate the leading digits of $3^{3^{3^{3^{3}}}}$ https://www.wolframalpha.com/input/?i=3%5E3%5E3%5E3%5E3 – Polv Aug 16 '21 at 08:30
  • 2
    @Polv You're right, I went one too high, WA does get an answer with four 3's. But still, my main point was that up-arrow is a lot more powerful than exponentiation. When you say "$3^{3^{3^3}}$ or $3\uparrow\uparrow\uparrow\uparrow3$", that tells me you haven't realized this. $3^{3^{3^3}}$ is equal to $3\uparrow\uparrow4$. That's nowhere near what you get with four arrows. – Arthur Aug 16 '21 at 08:37
  • 1
    We would need the fractional part of $(3\uparrow 3\uparrow 3\uparrow 3)\cdot \log_{10}(3)$ and $3\uparrow 3\uparrow 3\uparrow 3$ has $$3\ 638\ 334\ 640\ 025$$ digits. This might be feasible with extreme computational power, but if we add another $3$ to the power tower, the game is over. – Peter Aug 16 '21 at 08:38
  • 1
    To make Arthur's comment more exact (I do not know whether he means $10^{12}$ with "billion") : $3\uparrow \uparrow \uparrow 3$ is a power tower with $$3^{27}=7\ 625\ 597\ 484\ 987$$ threes. – Peter Aug 16 '21 at 08:47
  • Hence even the humble $3\uparrow \uparrow \uparrow 3$ has an utterly incomprehensible magnitude. This becomes much worse if we add another up-arrow ! – Peter Aug 16 '21 at 08:51
  • @Peter I don't know why I said "billion". I think it is just an old mistake that I never looked into again. – Arthur Aug 16 '21 at 08:52
  • Answering "I can't apprehend Knuth's up-arrow notation. So what is $g_{1}$ or $3\uparrow\uparrow\uparrow\uparrow3$?" is too long for a comment and should be its own question. In fact, I think I have already answered it a few years back. I use $3\uparrow\uparrow\uparrow 4$ instead of $3\uparrow\uparrow\uparrow\uparrow 3 = 3\uparrow\uparrow\uparrow(3\uparrow\uparrow\uparrow 3)$. – Arthur Aug 16 '21 at 08:53
  • To describe $$3\uparrow \uparrow \uparrow \uparrow 3$$ : Start with $3$ (step $1$). Then, create a power tower with $3$ threes (step $2$). Then, create a power tower with $3^{3^3}$ threes (step $3$). Continue this way until step $3\uparrow \uparrow \uparrow 3$. – Peter Aug 16 '21 at 08:55
  • $\log_{10}\left(\log_{10}\left (3^{3^{3^{3^3}}}\right )\right ) =\log_{10}\left (3^{3^{3^3}}\cdot \log_{10}(3)\right ) =3^{3^3}\cdot \log_{10}(3)+\log_{10}(\log_{10}(3))$ – Roddy MacPhee Sep 10 '21 at 19:07

1 Answers1

1

I'm not sure about the leading digit offhand, but I do know how to get the last digit. Tetration is usually written ${^k}x=x^{x^{x^{\dots}}}$ with $k$ $x$'s in the tower, and as I recall, $${^k}x \equiv c \pmod m$$ has the same value of $c$ given some $m$ and any $k>K$, where $K$ is a small constant, almost never out of single digits.

So this means that ${^3}3=3^{3^{3}}$ will have the same last digit as ${^4}3=3^{3^{3^{3}}}$ and so forth, up to infinitely many $3$s. This is equivalent to taking ${^k}3 \bmod{10}$ for large enough (i.e. non-tiny) $k$.

Note this also applies to any hyperoperations which themselves build off of exponentiation, such as Knuth up-arrows; they'll all have the same last digit as tetration.

When I was looking into this a couple years back I made, for Mathematica, this handy function:

tetmod[x_, k_, m_] := Which[
k==1, Mod[x, m],
k==2, PowerMod[x, x, m], 
True, PowerMod[x, EulerPhi@m + Mod[tetmod[x, k-1, EulerPhi@m], EulerPhi@m], m]
]

where tetmod[x,k,m] is ${^k}x \bmod m$. This can handle substantially larger power towers than you could otherwise.

FWIW, it was a while ago, so I may be forgetting about weird edge cases or something, but I remember this being a very robust result in general. For more details, try this thread as a jumping off point, or google tetration modulo.

For the record, I believe it's also straightforward to calculate exactly what $K$ you need for the mod to converge; it's something to do with the Carmichael function.

And to answer your actual question, we'll find that tetmod[3,5,10] yields $7$, so that's your final digit, as it is for any $3$-tower, i.e. $3^3$ and larger.

Trevor
  • 6,022
  • 15
  • 35
  • The last digit is always easy, but last n digits are not. I am trying to figure out right now, with https://en.wikipedia.org/wiki/Modular_exponentiation#Implementation_in_Lua As I directly use pow(int(base.last), exp.val, 10_000_000_000) (where pow is modpow in Python), for $3\uparrow\uparrow4$ I can get the answer of $...00739387$. However, if exponent's value cannot be totally determined (as in $3\uparrow\uparrow5$), I am ruined... – Polv Aug 16 '21 at 11:46
  • I mean $3\uparrow\uparrow\uparrow4$ and $3\uparrow\uparrow\uparrow5$ – Polv Aug 16 '21 at 11:52
  • I'm confused, is there some reason the same approach wouldn't apply? I.e. if ${^k}3 \bmod{10^8}=739387$, it should also hold for $3\uparrow^{a} x$. – Trevor Aug 16 '21 at 12:04
  • Okay, yeah, I get ${^4}3 \bmod {10^8}=739387$ too, but it looks like for all towers of height $k\geq 9$, taking it $\bmod 10^8$ always gives $64195387$. Since any up-arrow construct is ultimately a repeated power tower, this should be true of those also. – Trevor Aug 16 '21 at 12:15
  • 1
    (and if you specifically wanted the last eight digits of ${^5}3$, it's $60355387$) – Trevor Aug 16 '21 at 12:31
  • I don't understand, and just copied your code - I got the same answer (in Python). However, I still don't know how to calculate Euler's Phi algorithmically. (I cheated again with WolframAlpha.) – Polv Aug 16 '21 at 12:44
  • If you use sympy, there's a function for it, sympy.totient(). Otherwise, maybe something here. – Trevor Aug 16 '21 at 12:51
  • nvm, I got it https://www.geeksforgeeks.org/eulers-totient-function/ – Polv Aug 16 '21 at 12:51