What is this pattern called?

Solution 1:

What you've discovered is essentially modular arithmetic. By looking at only the last digits of a product (in whatever base you're looking at at the moment), you're in effect saying 'I don't care about things that differ by multiples of $n$; I want to consider them as the same digit'. For instance, in base $7$, $5\times 2=10_{10}=13$ has the same last digit as $4\times 6=24_{10}=33$; we put both of these numbers into a bucket labeled '$[3]$', along with $3$, $23=17_{10}$, $43=31_{10}$, etc. In mathematics, when we talk about $31 \bmod 7$ we sometimes just mean the number $3$ itself (that is, the 'label' on this bucket that's between $0$ and $6$, but it's often convenient to think of it as representing the whole bucket: whatever number we pick out of the $[3]$ bucket, when we add it to a number in the $[2]$ bucket, we know that our result will be in the $[5]$ bucket, and when we multiply a number in the $[3]$ bucket by a number in the $[4]$ bucket, we know that our result will be in the $[5]$ bucket; etc. "Last digits" are just a convenient way of talking about these buckets (though things get a little sketchier when you talk about negative numbers - note that according to these rules, $-3$ goes into the $[4]$ bucket!).

Meanwhile, the bands in your pattern are actually (pieces of) hyperbolas. Since $a\times (n-b)\equiv -(a\times b)\pmod n$ (the statement '$x=y\pmod n$' is a mathematical way of phrasing '$x$ and $y$ are in the same bucket in base $n$'; here, the difference between $a\times (n-b)$ and $-(a\times b)$ is $a\times n$), the far right hand side is essentially a reflection of the left, and similarly the bottom is a reflection of the top. If you rearrange the four quarters of your square so that the center of symmetry is (what was previously) the top left corner — i.e., take $A\ B\atop C\ D$ to $D\ C\atop B\ A$ — and then put the origin at the center, then the bands will exactly be (scaled versions) of the hyperbolae $xy=C$ (which are the hyperbolae $y^2-x^2=2C$ rotated by $45^\circ$). This happens because each 'cycle' of black-to-white or black-to-white-to-black will be separated by one multiple of $n$; e.g., the first transition between cycles occurs along the hyperbola $xy=n$; the second along the hyperbola $xy=2n$; etc.

(As for the moiré patterns, they're related to the usual way that such patterns are generated, and in particular they're somewhat related to aliasing near the Nyquist limit when the frequency between hyperbolic bands starts coming close to the frequency of the 'pixels' you're sampling with, but that's another story altogether...)

Solution 2:

You can model your graphics as computing $f_n(x,y)=n\left[\frac{xy}{n}\right]$, where here the square brackets are ad-hoc notation to mean taking the fractional part (or "reduce modulo 1"). This takes $z=xy$ and cuts it at a bunch of horizontal hyperbolae, collapsing the graph like a Fresnel lens. Then, what you are doing is sampling $f_n$ on integer points $\{(i,j)\in\mathbb{Z}^2:1\leq i,j\leq n\}$, but $f_n$ oscillates faster than your sample grid, leading to a Moire pattern.