Home • Essays • Lost Articles • Loose Ends • Collections • Computing • Projects • Widdershins • Quotations • Links • Us

 

Prime-Based Tapestries

On another page on this site, I talked about compressed prime number modulo tables.  To construct one of these, you establish a square array of cells.  Each cell going across the table represents a sequential integer, and it's lit up if that integer is a prime number.  The horizontal "wrapping" width of the table (the row width) is selected as a multiplicand of the first few primes.  I used 30 = 2 X 3 X 5 in my examples.  Then you throw away all the "dead" columns -- that is, the ones that show up without any primes in them -- and compress the "live" ones so that they are right next to each other.  With a starting 30-modulo table, you end up with 8 "prime-live" columns.  It ends up looking like the table to the right:

On that earlier page, I noted how the resulting "compressed" prime tables looked a lot like the old antique Jacquard loom programming card strips.  I wondered what kind of weave pattern you would get if you used these prime tables on such a loom.  An image of one of these programming card strips is shown to the left.  (I bought this strip from somewhere a bunch of years ago; I think it was from a Cracker Barrel Restaurant store in NC.  It makes for an unusual wall hanging!)

Well, I don't really know how these looms worked, or how the programming cards actually governed the shuttles, thread warp and woof, and so on.  But I figured I would go ahead and make my own imaginary tapestries from these "prime tables" as if they were used to directly produce a weave pattern.  I made the total image symmetrical by inverting, mirroring and copying the initially drawn 8 X 60 prime table section.  Here are some examples I obtained when doing this.  In these images, the cells are colored according to how "dense" the prime cells were around any given cell in the table.  In other words, the tapestry colors are established according to how many prime number cells are in the 8 neighboring cells around each target cell -- those 8 being the "compass star" around that cell, N, NE, E, SE, S, SW, W, and NW.  These tapestries are made with the upper left starting cell integer equal to 1, 15001, 1500001, 15000001, 1500000001, 15000000001, 150000000001, 1500000000001, 15000000000001, 150000000000001, 1500000000000001, respectively.  Each tapestry requires evaluation of 8 (columns) X 60 (rows) = 480 integers in the "seed" table.  My Intel 1.8 GHZ CPU was just about ready to bog down on that last one -- so I stopped my tapestry weaving at that point.

 

 

The prime factoring test routine I use is as follows:

 

    For n=[starting integer to ending integer]

        b = Int(Sqr(n) + 1)
        pr = 1   'assume the number is prime
        For i = 2 To b
            If n/ i = Int(n / i) Then    'if no remainder
                pr = 0  'fails the prime test

                i=b      'so stop the testing loop
            End If
        Next

        'Put your cell plotting routine here, prime if pr=1

    Next

 

Upon inspection, you'll see that this routine can be made a lot more efficient.  For example, if the number being tested is not even (divisible by 2), it's wasteful to continue to test it with other even divisors.  So it'd be better to pre-check the number for evenness, then continue the test with odd divisors only (i.e., the test loop being: For i=3 to b Step 2).  That simple enhancement could cut the testing time in half.  But heck, with a fast CPU it's not a big deal -- so long as you're not testing extremely large numbers.

If you are going to explore regions as high up as I did (150 trillion or more), you will have to declare your variable types (using VisualBasictm) as "variants".  Otherwise, they will give up the ghost, and your VB application will wander off towards its original home in Redmond, Washington (where Bill Gates keeps the VB "Main Loop" carefully hidden in his personal safe).

Notice that you only have to test up to the square root of n.  If it ain't factorable by then, it'll be a prime number.

These tapestry plots remind me a little of carpets woven in Turkey.  I like those because they use a lot more geometric shapes and patterns than in Persian, Belgian or other types of carpets.  Or maybe they evoke Mayan or Incan designs?

You can definitely see how the primes start to get sparser as the region of interest gets higher.  But they are always there! 

 

   Back to Prime Number Explorations...    

   


See http://www.recoveredscience.com/ for some very interesting information on prime numbers and various graphical arrangements of counting numbers that highlight the primes.

 

 

First-time visitors -- including you!

Free Web Counter

Free Hit Counter The Foggiest Notion The Foggiest Notion The Foggiest Notion The Foggiest Notion The Foggiest Notion

 

Luck Favors the Prepared Mind...

Essays • Lost Articles • Loose Ends • Collections • Computing • Projects • Widdershins • Quotations • Links • Us

Site contents Copyright 2004-2008 by Gary Cuba       Email: webmeister at thefoggiestnotion dot com