hyperop

python library for representing really, really, ridiculously large numbers.



Travis Hoppe

https://github.com/thoppe/python-hyperoperators

Addition,


Multiplication,


Exponentiation,


Tetration,


What about higher order operations?

? ? ?




hyperop


pip install hyperop

How does it work?

Functional programming in python, fold-right



reduce(lambda x, y: self.lower(y, x), [a]*b)

(boring) Examples


from hyperop import hyperop

H1 = hyperop(1)
print H1(2,3), H1(3,2), H1(5,4)
# >> 5, 5, 8

H3 = hyperop(3)
print H3(2,3), H3(3,2), H3(5,4)
# >> 8, 9, 243

from math import log
H = hyperop(4)
print H(2,5)
>>> 200352993040684646497....45587895905719156736

print log(log(log(log(H(2,5),2.0),2.0),2.0),2.0) == 2
>>> True

Infinte tetration!


H4 = hyperop(4)
print H4(2**0.5, 200)
# >> 2.0

Complex tetration!

Graham's number

hyperop is almost surely the first python library to offer support for it.
Was the largest computable finite number ever used in a proof.


it's kinda big



Larger than all the atoms of the Universe.


Larger than all arrangements of the atoms of the Universe.


This isn't Graham's number.

...



def GrahamsNumber():
    # This may take awhile...
    g = 6
    for n in range(1,64+1):
        g = hyperop(g)(3,3)
    return g

Comp. sci. technical question:
given infinite memory and time, will python fail?

Thanks, you!

@metasemantic



https://github.com/thoppe/python-hyperoperators