Coding Number Patterns

Number patterns as ASCII art

ASCII art is an early form of computer art, built
solely out of the original set of (up to) 256 characters, i.e. letters, numbers and
symbols, supported by early computers and text-based displays.
In this activity we look at how we can use some basic symbols, and computer
programming boolean expressions on a grid (i.e. expressions that have a value of
either true or false,
to generate some ASCII art of our own.

Use the table below to define and combine rules, and see the patterns that result. The row index is given by the variable i, and the column index by j. Use the operators +, -, *, / and % to work with the i and j values, and == or != to test equality. When multiple rules are combined, they are applied in turn, line by line.

Select a predefined rule from the menu in the first row of the table, or type your own rule into the following rows. Clicking on the grid will show the i and j coordinates for the particular cell.

Include | Condition (row = i, col = j) | True | False | Symbols |
---|---|---|---|---|

╱ | ╲ |

An interesting approach to the above activity is to try and predict in advance the pattern that an expression will generate. Break down the rules and consider aspects such as the behaviour if it only involves one of i or j for example.

The output is easily and directly related to coordinate geometry, modular arithmetic, and aspects of discrete vs continuous mathematics. Also connected are concepts of sets and their complements— compare i * j % 3 == 1 with i * j % 3 != 1 for example.

Most simple, but still fun, we can just appreciate the patterns inherent in numbers, and print them out to colour.

Boolean algebra, first developed by the English mathematician George Boole in 1847, is the branch of algebra that deals with truth logic, i.e. where, as for the pattern generating rules in the activity, all values are either true or false. Boole's work is fundamental to the particularly 20th & 21st century applications of digital electronics and computer programming.