Fibonacci v Primes: Cage Match!

Primes to 200, each modulo 31

Primes to 200, each modulo 31

Today I decided to more deeply investigate this curious math thing I discovered (for myself) – Plotting the Fibonacci numbers by Prime numbers each by a given modulo.  “Fibo-what? Mod-what? So what!”, you say. :p

tldr code: slice-seq and slice-seq.R

For the mechanics, I use Perl to produce the data and R to visualize it.

The first is the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …  The primes are of course: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, …  If you plot them on a graph, each sky-rockets because they are both sequences of bigger and bigger numbers.

What I have been interested in is “boxing in” an infinitely long sequence.

I use modulo (or “clock”) arithmetic to keep all numbers within a given range.  For example, the friendly 12 hour clock has a “range” of 12, so “13 o’clock” is equal to 1 o’clock and 23:00 == 11PM, etc.  My clocks are rectangular…

So for each prime number p(n), I find where it would be on the clock, and then do the same for the Fibonacci number F(p(n)).  Then I make a point and connect it to the previous point.  This makes a pattern that grows inside the clock-face box.  Some are crazy and random; some are curiously predictable.

Here are the first number pattern pictures, for 2 through 10, with primes below 100 (i.e. 25 primes) plotted:

plot-100-02 plot-100-03 plot-100-04 plot-100-05 plot-100-06 plot-100-07 plot-100-08 plot-100-09 plot-100-10

Here are the first few number pattern pictures for 31.  Each chart shows the “primes below” an increasingly higher number.  The first shows primes below 10, then 20, 30, 40, 50, 1000 and the last chart shows primes below 10,000.

plot-010-31 plot-020-31 plot-030-31 plot-040-31 plot-050-31 plot-1000-31 plot-10000-31

These might make a cool “flip-book” PNG animation for math geeks.  Maybe I’ll do that…