Constructing Natural Numbers

To describe the World we need numbers and we start constructing the natural numbers 1, 2, 3, 4, and so on, as many as needed. We shall construct the natural numbers by the basic operation of +1 according a computer program of the form

  • n = n + 1;

which starting with n = 0 as zero upon repetition constructs, 1 = 0 + 1, 2 = 1 + 1, 3 = 2 + 1, 4 = 3 +1, and so on. We shall see that the computer program n = n +1 is the mother of computer programs to construct-understand-control the world.

Note that the number n on the left of = in the expression n = n +1, is a new value given as a previous value on the right +1.

We see that repetition of one and the same basic operation of +1 creates the rich output of the natural numbers. This is how the world is created piece by piece into something whole, like building a house brick by brick or a human cell by cell.

We here use the 2 as a short hand of 1+1, 3 as short hand of 1+1+1, 4 as short hand of 1+1+1+1 and so on. What we effectively construct are strings

  • 1+1+1+1+1….+1+1

of different lengths by repetition of +1. From this representation we can figure out properties of natural numbers built in by construction and understand why e g 2+3 = 3+2.

A leading principle will be to find properties of mathematical objects from their construction.

Recall that the mathematician Kronecker said that:

  • God made the natural numbers; all else is the work of man.

We shall now let the computer play God and construct the natural numbers by repetition of +1, and from that construct all else. To our help we will then use the web editor p5js for JavaScript freely available on the web, which you find here.

When you open p5js you find the JavaScript template

function setup() {
createCanvas(400, 400);
}

function draw() {
background(220);
}

You see function setup() creating a display of size 400×400 pixels on computer screen.

You see  function draw() which will repeatedly execute the program to be filled in, as fast as possible depending on the computer with a maximal rate of 60 updates per second.

We now modify the template into:

let n=0;

function setup() {
createCanvas(400, 400);
}

function draw() {
background(220);
n=n+1;
print(n);
fill(0);
textSize(200);
text(n,50,200);
}

When we press the arrow to run the program we see a successive printout on the screen of the natural numbers by the command text(n,50,200) displaying n at position (50,200) with textSize(200), as well on the Console where things can be printed which are not wanted on the screen.

You are now invited to play with the program by changing the numbers and see the result, e g changing to n = n + 2;

You are invited to answer the following questions before proceeding to Session 2 where will enter into different representations of natural numbers in binary an decimal form as well as the basic operations with natural numbers of addition, subtraction, multiplication and division expressed in computer programs:

  1. What is the basic principle?
  2. What is the role of repetition?
  3. Is there a biggest natural number?
  4. Motivate why by construction 2 + 3 = 3 + 2  (commutative law). Generalise.
  5. Motivate why by construction (2 + 3) + 5 = 2 + (3 + 5)  (associative law). Generalise.

Before proceeding to the next example, get an account at p5js so that you can save your work.