3 minute read

I’ve lately been diving into SICP (Structure and Interpretation of Computer Programs) using Hy (a python lisp dialect) and I’ve lately been having a great time doing so. This is just one of those beautiful realizations I usually have strolling into the poetic realms of computer science.

A few digressions before getting to the core of my epiphany…

Hardy-Ramanujan Numbers

There’s this famous anecdote as told by Hardy..

I remember once going to see him [Ramanujan] when he was lying ill at Putney. I had ridden in taxi-cab No. 1729, and remarked that the number seemed to be rather a dull one, and that I hoped it was not an unfavourable omen. “No,” he replied, “it is a very interesting number; it is the smallest number expressible as the sum of two [positive] cubes in two different ways.”

Moving on, without justice to that…

I was having a look into probabilistic algorithms and a basic example one could look into is testing for Primality using Fermat’s Little theorem. The point is that they are mathematically uncertain (“mathematically”) but one could tag them as abstract engineering marvels.

Fermat’s little theorem states that if n is prime, for any positive integer smaller than n, $a^n$ is congruent $a mod n$.

If you’re interested in what’s so little about that, look into Fermat’s Last theorem.

Anyway, there exist Fermat pseudoprimes (termed as Carmichael numbers) that are not primes but still pass naive primality test algorithms based on fermat’s little theorem, making the algorithm techinically incorrect. But just to highlight the elegance of probabilistic algorithms, here I quote SICP…

Numbers that fool the Fermat test are called Carmichael numbers, and little is known about them other than that they are extremely rare. There are 255 Carmichael numbers below 100,000,000. The smallest are 561, 1105, 1729, 2465, 2821, 6601. In testing primality of very large numbers chosen at random, the chance of stumbling upon a value that fools the Fermat test is laess than the chance that cosmic radiation will cause the computer to make an error in carrying out a “correct” algorithm. Considering an algorithm to be inadequate for the first reason but not the second illustrates the difference between mathematics and engineering.

Look at that… 1729 is a Fermat pseudoprime too. I mean, what are the odds……………………….

Events as such, in one’s life, assert beliefs of class beyond comprehension. A concept formulated by humans can be so intrinsically eloquent was what I epiphanied (yes, you won’t find that in a dictionary) upon. Patterns, even though based on representations we envision, enigmatically permeate accross boundaries of what’s natural and what’s not.

This is probably going to be my new go-to-number for filler values, passing over all of the contenders : 42, 69, 420 … you name it…

Leave a comment