Embarrassing Solutions

Last night, a friend sent me this link. We discussed it for a bit, I sat down with a notebook and played with some numbers. Then I wrote the program to solve it (which I'm not posting because I don't think that would be fair). I think my solution was elegant, neat, and embarrassing. Because I think it's correct. My math is creaky enough that I can no longer remember how to prove my answer correct. I remembered how to generate prime factors and find the least common multiple (necessary for my solution), so my math isn't entirely shot, but it was a humbling experience. Worse, I might even be wrong.

The problem asks you to generate a number: the maximum number of times tries it's possible to get from the first typing of your name to actually seeing your name. The actual number of attempts is often lower and I think I know why, but I don't remember my statistics well enough to prove that, either. Hunches suck. I think I need to hit the math books again.

To test some ideas, I wrote another program which would actually generate the "typing" outlined in the problem. This helped me to quickly put to rest one suggestion someone else made. This isn't the problem they want you to write, so I think it's OK to post (and I think it shows off why I like Perl so much).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

This is interesting. A few months ago I posted a puzzle to london.pm that went something like this:

You have a rectangle raster of pixels - say 800 x 600 - stored in a linear array in normal raster fashion (so the first 800 elements of the array are the pixels from the top row, the next 800 from the next row and so on).

Now, you want to rotate that raster through 90 degrees and, crucially, you don't want to use much temporary storage. You certainly can't afford to keep a second copy of the raster so you h