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

Postby hooked » Fri Feb 12, 2016 8:13 pm UTC

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

Postby PsiSquared » Tue Feb 16, 2016 9:12 pm UTC

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

Postby hooked » Wed Feb 17, 2016 3:08 am UTC

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

Postby SAI Peregrinus » Sun Feb 21, 2016 10:29 pm UTC

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.


Return to “Mathematics”

Who is online

Users browsing this forum: No registered users and 10 guests