Algorithm Applications

I began my research into the hexagon using pencil and paper.  I painstakingly drew triangular grids, then plotted positions for each number, one after the other.  Friends took notice and intervened.

The first, Paul Jacobson, intervened to prove me wrong.  He wrote a quick script to show where the first prime would break out out of the hexagon.  I suspect his thinking was to disprove the hexagon so Tad could go look for a real job.  After several hundred million positions, no numbers left the hexagon, and he let it go.

Then my old friend Asbjørn Kvalheim got wind of my pathetic struggles with pen and paper and produced a beautiful webpage that runs an elegant javascript plotter for the hexagon.  I can not begin to tell you how affirming his efforts and words were for me when I started this process. Check out his work at  Password Ramanujan.  Don’t tell anyone.

Asbjorn’s application gave me values into the billions, which were very valuable, but I soon realized that the sequences I wished to explore quickly went beyond his database or the abilities of Javascript.  So I set about looking for a faster way to do business.  On the advice of Ted Wong, I taught myself rudimentary Python and wrote  The code I created was much faster, but could not generate beyond 50 billion on my machine.

A third friend, Perry Stoll, looked at my code – and once he’d stopped laughing and had dried his eyes – cleaned it up, integrated Numpy, Cython and the extraordinary prime sieve developed by Kim Walisch.   The code is brilliantly fast now and can go as high as one has time to calculate.  It can be found on my page on github.  I’ll be forever grateful for Perry’s assistance in building — and for the many nights we drank home brew and coded and marveled at how things worked.

While I’m at it I should give a shout out to my brother, Darrell Gallion, who offered clues along the way, tweaked some code and pointed me toward the prime sieve.

If you or someone you know is good with python, C++, GPU programming, or has access to a supercomputer, let me know as there is much more to be done.