## Python library for representing ridiculously large numbers

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

hooked
Posts: 6
Joined: Mon Oct 05, 2015 2:39 pm UTC

### Python library for representing ridiculously large numbers

Hi xkcd! I made a python module to explore and play around with hyperoperators. They aren't terribly useful in practice (with the rare exception of a few combinatoric and CS bounds) but it was a fun exercise to define Graham's number in terms of successors.

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

I'm happy to take any criticism, improvements, or pull requests. If you're not into a README, there's a short talk I made for our local Hack and Tell you can step through:

http://thoppe.github.io/python-hyperope ... res.html#/

PsiSquared
Posts: 126
Joined: Wed May 09, 2012 6:02 pm UTC

### Re: Python library for representing ridiculously large numbe

There's a small mistake in your program for Graham's number. The next to last line should be:

g = hyperop(g+2)(3,3)

And, of-course, the starting value for g should be 4 and not 6 (since you're adding 2 in the next-to-last-line).

Not that it matters, really, since the program won't terminate before the heat death of the universe, but there you go.

hooked
Posts: 6
Joined: Mon Oct 05, 2015 2:39 pm UTC

### Re: Python library for representing ridiculously large numbe

PsiSquared wrote:There's a small mistake in your program for Graham's number. The next to last line should be:

g = hyperop(g+2)(3,3)

And, of-course, the starting value for g should be 4 and not 6 (since you're adding 2 in the next-to-last-line).

Not that it matters, really, since the program won't terminate before the heat death of the universe, but there you go.

You're right! I mixed up Knuth's up-arrow notation with the hyperoperators (and hence the off-by-two error). I'll fix it in a jiffy!

To say that the program won't terminate before the heat death of the universe is a little unfair to the size of Graham's number. I did however leave it running until I ran out of memory, I'm not sure how I could incorporate that into a unit test...

SAI Peregrinus
Posts: 16
Joined: Mon Mar 30, 2015 8:02 pm UTC

### Re: Python library for representing ridiculously large numbe

David Metzler's "Ridiculously Huge Numbers" series is probably right up your alley. He starts with the Wainer hierarchy, then proceeds to the Veblen hierarchy and a bit beyond at the end. These functions make the values you can easily represent using the hyperoperators look positively tiny.