Random binary array shows patterns around prime numbers First post, so please let me know if I'm doing something wrong or if this question does not belong here.

I have been toying with java to visualize an interesting 2D binary array I thought of today in my math class. My thought was to start with one origin cell, and set all cells in an infinite grid equal to 1. Then, starting with the 8 cells surrounding the origin and moving outward, each cell would be evaluated by the following rule:

-If the cell at (x,y) == 1, then any cell at (nx,ny) = 0, for all positive integers n > 1

Basically I was thinking that if (1,0) was on, then all of the other cells behind it - (2,0), (3,0), etc... would be "in it's shadow" and therefore equal to zero. I figured the result would have some significance with prime numbers, and it did.

I wrote a program to plot all the cells in the 4th quadrant, up to about x=2000, y=1000 and took screenshots at various zoom levels. Here are the results:





The top left cell (0,0) is arbitrarily set to 1. Here's the algorithm:


    boolean [][] grid = new boolean[height][width];

    for(int x=0; x&lt;width; x++)
    {
      for(int y=0; y&lt;height; y++)
      {
          grid[x][y] = true;
      }
    }

    for(int x=0; x&lt;width; x++)
    {
      for(int y=0; y&lt;height; y++)
      {
          if(grid[x][y])
          {
              int xt = 2*x;
              int yt = 2*y;

              while((xt &lt; width &amp;&amp; yt &lt; height) &amp;&amp; (xt != 0 || yt != 0))
              {
                  grid[xt][yt] = false;

                  xt += x;
                  yt += y;
              }
          }
      }
    }



On a large scale, it looks somewhat uniform, but on a small scale it looks random (or at least I can't see the pattern).

Here's my questions:

1 - Has this "function" been researched before? It seems interesting to me, but I can't find anything online about it.

2 - Where is this randomness coming from? The code is so simple, but the result looks very complex.

3 - Is there any mathematical way for me to search this grid for patterns more efficiently than the naked eye? I can see that the vertical and horizontal lines are most prominent along the prime numbers, which is interesting.

Thank you, and sorry if this is a dumb question. I couldn't think of any other place to ask it.
This pattern is usually described in the following way: Suppose you stand at the origin, and at each lattice point $(x,y)\in\mathbb{Z}^2$ there is a thin pole stuck into the ground. Which lattice points are visible, i.e. which poles are not hidden behind other poles? The answer is that $(x,y)$ is visible if and only if $x$ and $y$ have no common factor $&gt;1$, since if $d$ is a common factor, then $(x,y)$ is hidden by $(x/d, y/d)$. 

If you search for visible lattice points, you will find articles ranging from introduction to research papers.
I've also made this graph sometime in the early 90's and noticed the diagonals. I note that they are formed by the multiples of primes. The multiples of 1: rise/run = 1/1; multiples of 2: rise/run = 2/1; ... etc. (I graphed in the 1st quadrant.)

Rather than focusing on only the red dots, it's interesting to focus on the white solid lines as well. Primes occur at the intersection of solid lines (no divisors of lesser value other than 1). So assigning a color to those lines can be of interest, as can be focusing on the patterns inside those squares, and the on-off pattern of the next higher line and the squares being formed by those unique on-off patterned lines.

Primes are definitely deterministic in where they appear, but the exact nature of the determinism is unknown and may even be unknowable. (I have a feeling it's recursive.) I came up with an algorithm that can output all primes in order if you seed it with a given prime and the primes that come before it that are higher than it's square root (you can start it at a very low prime in the list of all primes), but it doesn't appear to be good for finding huge primes because the computing time becomes outrageous.

I have an idea that the task could potentially be simplified, but I'm one of those "amateur mathematicians" and uncertain of that particular statement. The other statements, I'm confident about.