Computing 3âââ3 (In Python)
<p>I'm giving a presentation on <a href="https://en.wikipedia.org/wiki/Graham%27s_number" rel="nofollow">Graham's Number</a> and I wanted to compute the first few âs (i.e. 3â3, 3ââ3, and 3âââ3) to give them an idea of how huge it gets in such a short time. I wrote some naive/direct code in python, based on the definitions of arrow notation, shown below:</p>

<pre><code>def arrow2(a,b):
    c=1
    for i in np.arange(b):
        c=a**c
    return c

def arrow3(a,b):
    c=1
    for i in np.arange(b):
        c=arrow2(a,c)
    return c
</code></pre>

<p>Although "long" integers (limitless) and numpy arrays (limitless) were used, naturally the code takes up far too much memory while running and will take a very long time to process. Is there a solution to this? (or does someone already know the answer?) Thank you!</p>

<p>From <a href="https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation" rel="nofollow">Wikipedia</a>:<a href="https://i.stack.imgur.com/U0xV7.png" rel="nofollow"><img src="https://i.stack.imgur.com/U0xV7.png" alt="enter image description here"></a></p>

<p>Suppose you want to store this number (call it <code>N</code>) on a computer, i.e. in binary. This will require <code>k</code> bits, where <code>2^k ~ N</code>. That means <code>k</code> is itself extremely large (just compare <code>2^k</code> with the tower at the end), much too large to be stored on all the hard drives in the world.</p>

python memory bigdata