Colours of Numbers
by Karl Palmen

I discovered a way of colouring the natural numbers that I have found very fascinating. I use following eight colours: black, red, green, yellow, blue, magenta, cyan and white. (Before printing this page on a colour printer see the note at the bottom.)

It started years ago when I realised that those numbers that can be expressed as the sum of just two squares (1, 2, 4, 5, 8, 9, 10, 13 etc.) contain all their multiplication products (e.g., 2x5=10). This arises as a consequence of De Moivre's theorem in complex numbers. I became quite fascinated by these numbers and worked out a large number of them. I soon suspected a relationship between such numbers and the remainders of their prime factors divided by 4.

From the geometry of the complex plane I discovered a similar set of numbers. These are the numbers expressable as the sum of two squares and their geometric mean (1, 3, 4, 7, 9, 12, 13 etc.). These too contain their multiplication products (e.g., 3x4=12). I soon suspected a relationship between such numbers and the remainders of their prime factors divided by 3.

These considerations eventually inspired me to find my way of colouring numbers. The numbers that are the sum of two squares are either black or red and I believe that all numbers expressible as the sum of two squares and their geometric mean are either black or green.

The Rules for Colouring Numbers

The colour of each natural number can be determined by the following rules:
  1. When you multiply two numbers together, the colour of the resulting product is determined by the colours of the two numbers.
  2. When you multiply two numbers of the same colour, the resulting product is black.
  3. When you multiply a red number by a green number, the resulting product is yellow.
  4. When you multiply a red number by a blue number, the resulting product is magenta.
  5. When you multiply a green number by a blue number, the resulting product is cyan.
  6. When you multiply a red number, a green number and a blue number together, the resulting product is white.
  7. The colour of a prime number is determined by its remainder from dividing by 12 as follows:
    • 1 - Black
    • 2,5 - Red
    • 3,7 - Green
    • 11 - Blue

Fascinating Facts and Trivia

I believe the following are true.

Multiplying Colours

When you multiply two numbers together, the colour of the resulting product is determined by the colours of the two numbers as in the table below:

X black red green yellow blue magenta cyan white
black black red green yellow blue magenta cyan white
red red black yellow green magenta blue white cyan
green green yellow black red cyan white blue magenta
yellow yellow green red black white cyan magenta blue
blue blue magenta cyan white black red green yellow
magenta magenta blue white cyan red black yellow green
cyan cyan white blue magenta green yellow black red
white white cyan magenta blue yellow green red black

First 10 Numbers of Each Colour

The first 10 numbers of each colour are

Colours of the first 225 numbers

The numbers are here arranged in an anticlockwise spiral starting from 1 at the center.

Spiral

(This image was produced by the Prime Number Spiral program.)

Numbers Not Divisible by Six

Numbers of the form 3n+1 are black, white, green or magenta.
Numbers of the form 3n+2 are one of the other four colours.

Numbers of the form 4n+1 are black, white, red or cyan.
Numbers of the form 4n+3 are one of the other four colours.

The above two, imply that any odd number not divisible by 3 is either the same colour it would be if prime or the complementary colour.

These theorems are useful for proving much of what follows.

Square Numbers

All square numbers are black, because the product of any two numbers of the same colour is black. In particular, 1 is black.

Every number that is the sum of two squares a.a + b.b is either black or red.
If neither a nor b is divisible by 3, the number is red.
If either a or b is divisible by 3, but not both, the number is black.
If both are divisible by 3, the number is divisible by 9, the quotient, has the same colour and is is a sum of two squares.
A black or a red prime number is the sum of two squares.

Every number that is the sum of two squares and their geometic mean a.a + a.b + b.b is either black or green.
A black or a green prime number is the sum of two squares and their geometric mean.

Single Colour Polynomials

The polynomial k.x.x is the same colour for all integers x. Computation has suggested other such polynomials:

  1. 4.x.x + 3.m.m, where m is odd are all green.
  2. 9.x.x + m.m, where m is not divisible by 3 are all black.
  3. 9.x.x + 6.x + 2, are all red.
  4. 12.x.x + m.m where m is odd are all black.
  5. 12.x.x - 1 is for non-zero x blue.

The propositions in the previous section imply most of these.

1 and 10

Multiplying any number by 1 or any other black number leaves the colour of that number unchanged. Ten is black, hence adding a 0 to the end of a number leaves its colour unchanged.

Pairs

A maximum of two consecutive numbers may have the same colour. Any such pair must have a number divisible by 3 and its position in the pair is determined by the colour.

The first pair of each colour is as follows:

It is possible for two pairs of the same colour to be separated by just one number. This first happens for the first two green pairs. It is also possible for two pairs of different colours to run in succession. This first happens with 84, 85 - Black and 86, 87 - Yellow.

Arithmetic Progressions

If three numbers of the same colour are in arithmetic progression, their common difference must be divisible by 3. Examples are 2, 5, 8 - Red and 16, 25, 34 - Black.

If four or more numbers of the same colour are in arithmetic progression, their common difference must be divisible by 12. Examples are 1, 13, 25, 37, ... 373 - Black and 11, 71, 131, 191, 251, 311 - Blue.

Mersenne Primes

All Mersenne primes 3, 7, 31, 127, ... are green. The largest known prime is probably a Mersenne prime and therefore green.

Fermat Numbers

All Fermat numbers 5, 17, 257, 65537, ..., except 3 are red.

Perfect Numbers

All known perfect numbers 28, 496, 8128, ... except 6 are green. Any odd perfect number must be either black or red.

Numbers 26, 27, 28, 29, 30, 31, 32

These 7 consecutive numbers are red and green. They form a symetrical pattern around the first two green pairs.

66 and Other White Numbers

66 is the first white number.
It is the last number of a different colour to all lower numbers.
Like all white numbers, it has factors of all other colours.
Each of its factors are the first number of its colour.

White numbers are quite rare, but gruadually become less rare for larger numbers. We have two consecutive white years coming up (2001, 2002) the next white year is then 2065.

A white number must have at least three prime factors. It has, including both itself and 1, an equal number of factors of each colour. E.g., for 2002:

Factors of a White Number (2002)

The number of factors that a white number has, including itself and 1, is a multiple of 8.

Numbers 122, 123, 124, 125, 126, 127, 128

These seven consecutive numbers go red, yellow, green repeatedly and so do, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Any sequence of a 3-colour cycle, has a maximum of three odd numbers and so is limited to seven numbers. It also may only have two numbers divisible by 3.

Numbers 136, 137, 138, 139, 140, 141, 142, 143

These eight consecutive numbers are of all eight colours. Since 144 is a square number it is black and hence 137, 138, 139, 140, 141, 142, 143, 144 are also eight consecutive numbers of all eight colours.

Numbers 225, 226, 227, 228, 229, 230, 231, 232

These eight consecutive numbers are of just two colours. If you add 288 to these numbers, you get 513, 514, 515, 516, 517, 518, 519, 520 in which all the black numbers remain black and all the blue numbers become yellow.

Any two-colour sequence of at least four consecutive numbers must have its two colours multiplying to either blue or yellow. Such a sequence can not have more than nine numbers in it and if it does have nine numbers, one colour must be either black or white and the other colour either blue or yellow.

Colours of Fractions

If a/b is a whole number, it has the same colour as ab. Rational numbers can be coloured by making this (i.e., a/b same colour as ab) apply to fractions too. Then 1/n has the same colour as n. Many of the above propositions do not apply to fractions.

The following are examples of colours of fractions:

The square root of 2 can not have a colour, because if it did, the colour of its square would be black, contradicting the fact that it is red (2 is red). Hence the square root of 2 is irrational.

Challenges

  1. Is there a general algorithm for calculating the colour of a given number, that is decisively more efficient, than factorising into prime factors?
  2. Find nine consecutive whole numbers of only two colours.
  3. Find eight consecutive whole numbers of all eight colours, other than 136-143 or 137-144.
  4. Find a number three less than a power of four and of a different colour than that power of four. The same challenge but with a power of two has been met, by finding
    1. 8,189 = 19 * 431 cyan 8,192 = 2^13 red
    2. 33,554,429 = 479 * 70,051 cyan 33,554,432 = 2^25 red
  5. Does every non-negative real number have a sequence of black numbers that converges to it? If so, is there an algorithm to construct such a sequence?
  6. Find another fascinating fact.


This page may be printed on a black-and-white printer, which, not surprisingly, will not show the colours. If it is printed on a colour printer then the text in white will not be printed. A version of this page more suitable for printing on a colour printer is here.

Last modified: 2001-01-23

Karl Palmen's Calendars Prime Number Spiral
Factorizer Hermetic Systems Home Page