Number Systems and Arithmetic
The study of mathematics begins with numbers. We build complex systems from simple foundations, starting with the natural numbers.
The Hierarchy of Numbers
- Natural Numbers (): (counting numbers).
- Integers (): .
- Rational Numbers (): Fractions where and .
- Real Numbers (): Includes irrational numbers like and .
- Complex Numbers (): Numbers of the form .
python
1import numpy as np
2
3def classify_number(n):
4 if isinstance(n, complex):
5 return "Complex"
6 if n % 1 == 0:
7 return "Integer/Natural"
8 return "Fractional/Real"
9
10test_cases = [42, 3.1415, complex(1, 2)]
11for n in test_cases:
12 print(f"{n} is {classify_number(n)}")
Peano Axioms
The natural numbers are rigorously defined by the Peano axioms, which use a single constant and a successor function .
- is a natural number.
- For every , is a natural number.
- No two numbers have the same successor.
- is not the successor of any number.
Fundamental Theorem of Arithmetic
Every integer greater than 1 either is a prime number itself or can be represented as a unique product of prime numbers.
python
1def prime_factors(n):
2 i = 2
3 factors = []
4 while i * i <= n:
5 if n % i:
6 i += 1
7 else:
8 n //= i
9 factors.append(i)
10 if n > 1:
11 factors.append(n)
12 return factors
13
14print(f"Factors of 12: {prime_factors(12)}")
15print(f"Factors of 37: {prime_factors(37)}")