Monday, June 28, 2010

(Amateur) Mathematical Interlude

Incidental encounters with the “FizzBuzz” problem and the Project Euler problems got me thinking about divisibility and sieve of Eratosthenes. Listing the numbers, I noticed they followed a pattern. If you list all the numbers up to and including the least common multiple (LCM) of a sequence of numbers, it seems to form a palindromic sequence.

For example, here is the FizzBuzz sequence (starting with zero) with 3 and 5, where “3” means divisible by 3, “5” divisible by 5, “a” divisible by both, and “.“ divisible by neither:


Here is 4 and 6:


And 2,3, and 5 (using a,b,c,d for multiple divisibility):


Now, here’s the deal. If you extend this to the entire sequence of primes up to a given index, that should also be a palindromic sequence (proof is left to the reader). And if you take the endpoint (LCM) of that sequence, the form will always be “.x.” In other words, a multiple surrounded by prime twins, relative to the sequence.

My wonder is, and I’m not enough of a mathematician to puzzle this out, is what relationship does this generator of relative prime twins have to the universe of prime twins? What fraction of the numbers it generates are prime twins, and does that fraction approach some limit, or does it continue to fall?

Like I said, I’m no mathematician; questions like these are probably as simple to mathematician as questions like “should I use an int or a float” are to a programmer. It just shows how new interesting questions can stem from the confluence of others.


p.s. You can graph these types of palindromic sequences by incrementing each cell in the sieve by a number corresponding to the power of two associated with the index (minus one) of the prime number. E.g. 2=1,3=2,5=4,7=8,etc. This will assign a unique number based on divisibility, which can then be graphed.

For example, here (with gratuitous colorization) is the graph for 2,3,5:

No comments: