# Mystery counting grid pattern

So I was watching this Vihart video (which I highly recommend, by the way), and there’s a bit at the end where she’s just filling up space on a page by writing out the natural numbers, one per line, looping back to the top when she gets to the bottom and appending the continued ones onto each line. Then she highlighted the different digits in different colors, and a somewhat interesting pattern started to form.

If you’re not clear on what’s going on here, here’s a small example, of what you get on a 6x5 grid, with alternating bold/italic to show the different numbers that are being counted (read top to bottom, left to right).

1 | 6 | 1 | 0 | 1 | 5 |

2 | 6 | 1 | 1 | 1 | 6 |

3 | 7 | 1 | 2 | 1 | 7 |

4 | 8 | 1 | 3 | 1 | 8 |

5 | 9 | 1 | 4 | 1 | 9 |

It gets more interesting when the number of rows isn’t a factor of 10, like this 6x4 grid:

1 | 5 | 9 | 1 | 3 | 1 |

2 | 6 | 1 | 0 | 1 | 4 |

3 | 7 | 1 | 1 | 1 | 5 |

4 | 8 | 1 | 2 | 1 | 6 |

So that got me interested in what might happen if I were to make that pattern much bigger, over an arbitrary variety of grid sizes. So I built a little toy that does exactly that (thank you wacky arbitrary code embedding tools!). This displays a gradient from dark to light for digits from 1-9, and zeros are in red.

It’s not really as interesting as I’d hoped, but it’s not … *not interesting*.