Creating art on a computer screen is rational

Most people encounter turning points in their lives, and one of the earliest in mine came while deciding to apply for: I loved both chemistry and maths and had the A-level results to study either. I could have become a mathematician, but the lure of smells and bangs was too strong.

However, I've never lost my love of maths, especially number theory, and I still do some for fun from time to time. In the 1960s, I spent months playing at topology, in particular, notations for classifying knots. More recently, I wanted to hear what the prime numbers sound like, which led me into a computer music composition project.

A subject of fascination for me has always been irrational numbers. These are numbers that can't be expressed as fractions that is as the ratio of two whole numbers such as 12 or 3,793/8,331. Examples are pi and 2, which can only be represented by infinitely long, non-repeating strings of decimal (or binary, hex, octal and so on) digits, which are impossible to complete. And the weirdest thing about irrational numbers is how many of them there are.

Consider this. You can present all the numbers as a line that stretches off forever to the left and right, on which every point represents a different number. You can tick off the whole numbers along this line, like the marks on a ruler, and in between each mark, there will be infinitely many rational numbers, fractions whose decimal representation comes to an end like 4.567757, and infinitely many irrational numbers.

The scary thing is that there are 'more' (whatever that means) irrationals than anything else, because if you choose a point at random on the line, there's a 100% chance it will be irrational! I know, it made me feel seasick too when I learned this, from an article in Quanta Magazine called "Why Mathematicians Can't Find the Hay in a Haystack". Almost all the numbers we use in everyday life are rational, whole numbers such as 12 eggs or fractions such as 4.56, but these are like needles in an infinite haystack of irrationals, impossible to locate by random search. And worse still, the hay itself is impossible to describe in finite space.

Rational numbers are easier to handle, and they're all we can deal with on a computer that has both finite memory and finite word-length. But even rational numbers can boggle the mind. Another of my passions is computer graphics, and images on a computer screen are really nothing but tables of numbers, displayed as colour intensities by the graphics hardware.

Suppose your computer has a 1,920 x 1,080 display and 32-bit colour; then every line on that screen could be represented by a 61,440-bit long binary number, and every possible image by a 66,355,200-bit number (61,440 x 1,080).

So, you could write a program that counts from 0 to 66,355,200, converts each number to a bitmap and displays it, and it would eventually show everything that could be possibly seen on that screen, like the proverbial monkeys on typewriters that might produce Shakespeare. It wouldn't take infinite time, either: if you showed each picture for a second, you'd be done in two years, although I wouldn't sit up waiting for the Mona Lisa to appear.

The more I think about this, the more I want to set it up in a gallery people might sit in front of it hoping to see something recognisable, like the librarians in Jorge Luis Borges' The Library of Babel searching for a legible word.

Maths is like a good rollercoaster that induces vertigo, nausea and pleasure all at the same time. For me, the ultimate boggle is Cantor's "diagonal" proof that there are infinitely more real numbers, rational and irrational, than there are whole numbers.

Build a table, infinitely deep and infinitely wide, of all the real numbers. Traverse this table diagonally, taking the first digit of line one, second digit of line two and so on, add one to it and string these all together into a new infinitely long number. This new number can't be anywhere in the table because it differs from every number in the table in one place, so infinity squared isn't big enough to hold them all they are uncountable.

First encountered at school, this still hurts my head a little even now.

Perhaps I made the right choice after all: in chemistry, you can only poison yourself or blow yourself up.