Recursive definition of natural numbers

1.5k Views Asked by At

I'm doing the exercises in Algorithms and Data Structures in Java, Second Edition, by Adam Drozdek.

One question is:

The set of natural numbers $\mathbb{N}$ defined at the beginning of this chapter includes the numbers $10,11,\dotsc,20,21,\dotsc$,and also the numbers $00,000,01,001,\dotsc$.Modify this definition to allow only numbers with non leading zeros.

Here is the definition given at the beginning of the chapter (the faulty one):

  1. $0, 1, 2, 3, 4, 5, 6, 7, 8, 9 \in \mathbb{N}$;
  2. if $n \in \mathbb{N}$, then $n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 \in \mathbb{N}$;
  3. these are the only natural numbers.

My modified definition, to exclude leading zeros, is:

  1. $1, 2, 3, 4, 5, 6, 7, 8, 9 \in \mathbb{N}$;
  2. if $n \in \mathbb{N}$, then $n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 \in \mathbb{N}$;
  3. these are the only natural numbers.

Is my modified version correct?

1

There are 1 best solutions below

0
On BEST ANSWER

Note that $0 \notin \mathbb{N}$ in your modified definition, so it cannot be correct.

A couple of ways to fix it are:

  1. $0, 1, 2, 3, 4, 5, 6, 7, 8, 9 \in \mathbb{N}$;
  2. if $n \in \mathbb{N} \setminus \{0\}$, then $n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 \in \mathbb{N}$;
  3. these are the only natural numbers.

or

  1. $1, 2, 3, 4, 5, 6, 7, 8, 9 \in \mathbb{N}^+$;
  2. if $n \in \mathbb{N}^+$, then $n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 \in \mathbb{N}^+$;
  3. these and $0$ are the only natural numbers.