Compute the largest known prime, from a .signature file

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).

Technorati Tags: ,

Recreational Math: The Kruskal Count

This is the kind of paper I read when I have a lunch hour by myself at the local sushi bar.

[math/0110143] The Kruskal Count

The Kruskal Count is a card trick invented by Martin J. Kruskal in which a magician “guesses” a card selected by a subject according to a certain counting procedure. With high probability the magician can correctly “guess” the card. The success of the trick is based on a mathematical principle related to coupling methods for Markov chains. This paper analyzes in detail two simplified variants of the trick and estimates the probability of success. The model predictions are compared with simulation data for several variants of the actual trick.

Technorati Tags:

SeisMac

Through some convergence of factors (namely, my experience trying to read the accelerometers in the Wii remote, last night’s earthquake, and this mornings blear eyed checking of the Make Blog feed) I found the application below, which turns your Macbook or Macbook Pro into a seismograph by reading the accelerometer inside. I tried it on my budget Macbook. It works. Silly me, I though only the pros had accelerometers. Great, now I have something else to play with.

Suitable Systems / SeisMac