D
D
Daniil Kolesnichenko2015-06-03 21:14:07
Python
Daniil Kolesnichenko, 2015-06-03 21:14:07

Tetrating in Python?

I did not find functions for number tetration in NumPy / SciPy, where to look?
The function I wrote crashes due to stack overflow even on small numbers, in all sorts of numpais they are written here, it should be better with this, probably ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bobrovskyserg, 2015-06-03
@KolesnichenkoDS

Small - how much? 2^^5 ~ 2*10^19729, 2^^6 ~ 10^(6*10^19728).
There is no need to look anywhere, in python there is excellent integer arithmetic, and the whole blow falls on a single action - the last exponentiation. And there can be nothing with the stack:

def tet(a, n):
    return a ** (tet(a, n - 1)) if n else 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question