## Back-Story

I became interested in the patterns in multiplication tables for different base number systems a while ago. Specifically, the pattern made by the last digit of each number in the multiplication table. So, base 10 would look like this:

`1|2|3|4|5|6|7|8|9|0 2|4|6|8|0|2|4|6|8|0 3|6|9|2|5|8|1|4|7|0 4|8|2|6|0|4|8|2|6|0 5|0|5|0|5|0|5|0|5|0 6|2|8|4|0|6|2|8|4|0 7|4|1|8|5|2|9|6|3|0 8|6|4|2|0|8|6|4|2|0 9|8|7|6|5|4|3|2|1|0 0|0|0|0|0|0|0|0|0|0`

I thought it was interesting that when you move to number systems with different bases, the patterns don’t follow the number. They follow it’s relative position in the number system. E.g., in base 12, the pattern is 6,0,6,0,6……

## Images

I then realized, I could see the pattern better if I just assigned each number a color. I started with using 10 greyscale colors, with 0 being black and 9 being white. So now base 10 looks like this:

Then, I figured that I really could use as many colors as I wanted to, and see if a larger pattern forms. Using all 256 greyscale colors, I came up with this image representing a base 256 multiplication table:

Or I could go from black to white to black, and smooth out the image:

## Animation

I decided to animate the pattern to better see what was going on. To do this, I defined my 1-n color scale as

`[w,w,w,w,b,b,b,b,b,b,b,b....]`

. Where`w`

is white and`b`

is black. I would create a frame, shift my colors down one`[b,w,w,w,w,b,b,b,b,b,b,b....]`

, and create the next frame. I repeated this until they colors fully cycled and got this .Here’s a site where you can modify the settings.

## What is this pattern called?

My question is, what is this pattern called? I’m having a hard time finding anything about it. It seems to be a bunch of hyperbolic curves imposed on each other. There is a bunch of “stars” at the corners of where you would divide the image into 4ths, 9ths, etc.

Any insight into this would be appreciated.

**Answer**

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…)

**Attribution***Source : Link , Question Author : Alex McKenzie , Answer Author : Steven Stadnicki*