Compute the largest known prime, from a .signature file

March 2, 2007 | General | By: Mark VandeWettering

Okay, most of the ones of these I’ve written have been at least a little obscure or obfuscated. This one is entirely straightforward, and is further unremarkable because you need to have the gnu bignum library to make it work. Shrug. It’s still kind of fun, and it demonstrates just how straightforward the library is to use.

Here’s the source code.

I found that I had to set my process limits up (apparently the print routines allocate memory on the stack, and that causes problems when your number has almost 10 million digits). In csh, that means “limit stacksize unlimited”. I had space to include that in the comment.

If you want something REALLY clever, try Fabrice Bellard’s obfuscated program to do the same thing. It’s a little too large for a .signature file, but it requires no additional libraries, and is positively diabolical. I must admit that I had a tiny bit of problems compiling this one, because the LL qualifier appearing on the second line seems to parse badly when it is broken up onto two lines. Still, very neat (and very fast too).

[tags]Prime Numbers,Mathematics[/tags]

Comments

Comment from metamerist
Time 3/3/2007 at 11:34 am

I once thought of creating a freeware utility that would attempt to factor RSA numbers with spare machine cycles, like SETI, etc. (Perhaps someone’s already done it now.)

Call it something catchy like “lotteryware” and split prize 50/50. Even if you never won, the possibility would always be hanging out there–all those machine out there working on the problem…

Anyhow, free idea…

🙂