CLN is a C++ library that allows you to do arithmetic with arbitrarily large integers.
As an example, I have written a program, ammprobcln.cpp, that searches for solutions to the equation
You don't have to be an expert C++ programmer to use this library. Take a look at the C++ program. The main loop of the computation is at the bottom, beginning with the line that says while ( n <= nlast ). (Note that n3 + n2 + n + 1 = (n2+1)(n+1).) The code before this point consists of C++ header information, variable declarations, and some code that gets the numbers from the command line. You can use this C++ file as a template for your own programs.
To learn about the CLN functions that are available, check out the CLN documentation. In particular, for integers, you will find an assortment of interesting functions (including gcd, lcm, and more) in Section 4.9, and the sqrtp function that I used in my example is documented in Section 4.7.
Experienced programmers, or users of software such as Maple or Mathematica, might ask about alternatives to CLN.
| Maple | 130. sec | CLN (C++) | 12.8 sec |
| GMP (C) | 5.3 sec |