Thursday, May 05, 2011

Prime Fun

Just a little thing for you today... a HUGE little thing.

Often when I am here doing my work - that is, my OTHER work, my writing on the Saga - I am distressed to see that my computer is sitting idle while I am busy.

I find this very disturbing. Why should it sit there and twiddle its digital thumbs (oy, what a redundancy!) while ***I*** am busy struggling to organize my thoughts? So I thought to myself, what little chore might I set it to working on while I am busy?

I debated this; there are too many things where I would mistrust my machine if left to its own devices. (hee hee) So I decided upon prime numbers. These are safe, lots of good healthy fun for a young speedy and carefree machine.... Very well, I said: I will have it find me some prime numbers. Big prime numbers. (The little ones I can find for myself.)

Alas. I wroght my code too well. It soon found all the primes up to its 32-bit limit - that is, the last "number" which it "knows" how to deal with easily: 4294967295. There are over 230 million such primes, and the largest is 4294967291. The smallest is 2, but I found that one all by myself. In fact I had to explain all that to it when I started, since it didn't understand me when I typed in "Find me some primes." Hee hee. What a stupid machine. Fast but stupid.

So now I have a nice little file, some 800 megabytes long, full of all of them. It is a wonder to behold. After that rather fun little project I let the computer relax while I debated the next project. Then I had it begin the exploration of the next bunch of numbers which it still knows how to handle, though not as readily: the 64-bit integers which go up to 18 followed by eighteen zeros. (That's larger than the largest known whale.) Now of course there is not enough disk space on the planet - such things remind me of that line at the end of St. John's gospel (Jn 21:25) ... hee hee - so I stopped that after a while.

Then I decided on another something: prime palindromes. That would be fun too! Let's see: 11, 101, 131, 151, 181... Wow. So I dashed off another little demand, that is, instructions for my computer to keep it busy and off the streets. And so, over the weekend, it finished examining all those primes with 15 places in base ten which are palindromes: that is, from

100 000 323 000 001
up to
999 999 787 999 999

In the meantime, I found out why there can only be one prime palindrome with an even number of places... but - uh - this blogg-box is too small to contain my proof. Hee hee hee. (How's that, Mr. Fermat?)

Yes. I could have it do the 17-place ones next, but I am not sure what I choose to assign it. There are so many fun questions... But whatever I select will be fun for me, and entirely safe for this little machine.

Unless (shh!) unless there are still some spies around.

You know as well as I do that old saying we herd back in grad school:

"SPIES LIKE BIG PRIME NUMBERS."

So perhaps I ought to encrypt this posting.

Nah. But you can if you want to. And if you need some large primes, I know where you can get some. Heh heh. (Hey buddy. Want a prime?)

Now, back to work.

0 Comments:

Post a Comment

<< Home