Books, Dynamic Programming, Large Integers, Linear Programming, Matrices, Software, Visualization

Fun with large integers

C++

Check out GMP and NTL. See Using NTL with GMP, and NTL Examples.

If you are running Mac OS X, you can install NTL and GMP together like this:

sudo port install ntl +gmp

On Ubuntu GNU/Linux, use the Synaptic to install GMP packages libgmp3c2 and libgmpxx3.

Java

Java has java.math.BigInteger.

Python

Python supports large integers out of the box:

>>> print 2**256
115792089237316195423570985008687907853269984665640564039457584007913129639936

Python readily computed 2**(2**16), but 2**(2**32) really gave it heartburn on my Mac.

Lisp

Grab the CLISP code from the bottom of Robert Kosara's page on the Ackerman function and try this:

(ackermann 4 1)
(ackermann 4 2)

Maybe that last one (19,729 digits) was as big an integer as you'll ever need. I hope so, because this one breaks the bank:

(ackermann 4 3)

Octave

Octave does not support large integers directly. However, I learned from the help-octave mailing list that OctaveForge has a vpa function which is a wrapper for GMP.

Mathematica

Mathematica supports large integers:

2^256
115792089237316195423570985008687907853269984665640564039457584007913129639936

Mathematica was able to compute 7^(7^7), but 7^(7^(7^7)) resulted in overflow.

gsk