CMSC250

Number Properties

Number Properties

Parity
Divisibility
Primes
Modular Arithmetic
Closure

Parity

Integer:a number that can be written without a fractional part

Integer:a number that can be written without a fractional part

(AKA a full number)

Parity:Property of an integer being even or odd

127: odd

354: even

999: odd

-192: even

Even or Odd

Even or Odd

\(x \text{ is even if there is some integer }y \text{ such that } x = 2y\)

\(x \text{ is odd if there is some integer }y \text{ such that } x = 2y + 1\)

\(x \text{ is even if there is some integer }y \text{ such that } x = 2y\)

\(x \text{ is odd if there is some integer }y \text{ such that } x = 2y + 1\)

\(x \in \mathbb{Z}^{even} \Leftrightarrow (\exists y \in \mathbb{Z})[x = 2y]\)

\((\forall x \in \mathbb{Z}^{even})(\exists y \in \mathbb{Z})[x = 2y + 1]\)

\(x \in \mathbb{Z}^{odd} \Leftrightarrow (\exists y \in \mathbb{Z})[x = 2y + 1]\)

\((\forall x \in \mathbb{Z}^{odd})(\exists y \in \mathbb{Z})[x = 2y + 1]\)

\((\forall x \in \mathbb{Z}^{even})(\exists y \in \mathbb{Z})[x = 2y + 1]\)

\((\forall x \in \mathbb{Z}^{odd})(\exists y \in \mathbb{Z})[x = 2y + 1]\)

Example: 729 is odd; \(729 = 2(364) + 1\)

Example: 14 is even; \(14 = 2(7)\)

Example: -14 is even; \(14 = 2(-7)\)

Divisibility

We say something is divisible by a number if there is no remainder

\(x\) divides \(y\), if there is some (unique) integer \(z\) where \(xz = y\)

\(x\) divides \(y\), if there is some (unique) integer \(z\) where \(xz = y\)

\(x \vert y\)

\(x\) divides \(y\), if there is some (unique) integer \(z\) where \(xz = y\)

\(x \vert y\)

If there is no such \(z\), then we say \(x\) does not divide \(y\)

\(x \nmid y\)

Note: \(x\) cannot be 0

\(x\) divides \(y\), if there is some (unique) integer \(z\) where \(xz = y\)

Given integers \(x, y\), with \(x \neq 0\), \(x \vert y\) iff \((\exists z \in \mathbb{Z})[xz = y]\)

\(x\) divides \(y\), if there is some (unique) integer \(z\) where \(xz = y\)

\((\forall x \in \mathbb{Z}^{\neq 0})(\forall y \in \mathbb{Z})[x \vert y \Rightarrow(\exists z \in \mathbb{Z})[xz = y]]\)

\(5 \vert 15\) is true because \(5(3) = 15\)

\(3 \vert 10\) is false, because there is no integer z where \(3z = 10\)

\(7 \vert 7\) is true, because \(7(1) = 7\)

\(-2 \vert 14\) is true, because \(-2(-7) = 14\)

Primes

A number is prime if its only positive factors are 1 and itself

A number is prime if its only positive factors are 1 and itself

A positive number is composite if its not prime

\(x\) is prime if the only positive divisors of \(x\) are \(1\) and \(x\)

\(x\) is prime if the only positive divisors of \(x\) are \(1\) and \(x\)

\(x\) is composite if there are positive integers \(y,z > 1\) with \(x = yz\)

\(x\) is prime if the only positive divisors of \(x\) are \(1\) and \(x\)

\(x\) is composite if there are positive integers \(y,z > 1\) with \(x = yz\)

Note: \(x \le 1\) is neither prime nor composite

\(x\) is prime if the only positive divisors of \(x\) are \(1\) and \(x\)

\(x\) is composite if there are positive integers \(y,z > 1\) with \(x = yz\)

\(x \in \mathbb{P} \Leftrightarrow (\forall d \in \mathbb{Z}^{>0})[d\vert x \Rightarrow (d = 1 \lor d = x)]\)

\(x\not\in\mathbb{P} \Leftrightarrow (\exists d \in \mathbb{Z}^{>0})[d\vert x \land 1 < d < x]\)

\(x\) is prime if the only positive divisors of \(x\) are \(1\) and \(x\)

\(x\) is composite if there are positive integers \(y,z > 1\) with \(x = yz\)

13 is prime, only divisors are 1 and 13

51 is composite, \(51 = 17(3)\)

Modular Arithmetic


              if(x%2 == 0)
            

\(x \% m = r\)

\(x \equiv r \text{ (mod } m)\)

\(x \equiv r \text{ (mod } m)\)

\(m \vert (x - r)\)

\(x \equiv r \text{ (mod } m)\)

\(m \vert (x - r)\)

(r - x) = -(x - r)

\(x \equiv r \text{ (mod } m)\)

\(m \vert (x - r)\)

\(12 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (12 -2)\)

\(22 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (22 -2)\)

\(x \equiv r \text{ (mod } m)\)

\(m \vert (x - r)\)

\((\forall x, y \in \mathbb{Z})(\forall m \in \mathbb{Z}^{\ge 2})[x \equiv y (\text{ mod } m) \Leftrightarrow m \vert (x - y)\)]

\((\exists k \in \mathbb{Z})[x - y = km]\)

\(12 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (12 -2)\)

\(22 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (22 -2)\)

22%5 == 2%5 == 12%5

\(12 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (12 -2)\)

\(22 \equiv 2 \text{ (mod } 5)\) because \(5 \vert (22 -2)\)

22%5 == 2%5 == 12%5

\(22 \equiv 12 \text{ (mod } 5)\) because \(5 \vert (22 -12)\)

\(-8 \equiv 7 \text{ (mod } 3)\) because \(3 \vert (-8 -7)\)

\(-8 = -5(3) + 7\)

-8%3 == 1 && 7%3 == 1

Closure

We have operations which we can perform on operands

We have operations which we can perform on operands

\(2 + 3\)

Operator: \(+\)

Operatorands: \(2, 3\)

We have operations which we can perform on operands

Operations have results

The result of \(2 + 3\) is 5

We have operations which we can perform on operands

We have operations which we can perform on elements of a set

Addition: can be performed on elements of the Naturals \((\mathbb{N})\)

The result could also be part of the set

The result could not be part of the set

Closure: property of an operation upon a set where the result and operand(s) are all from the same set

\(\mathbb{N}\) is closed upon addition

\(\mathbb{N}\) is not closed upon Subtraction \((2-3 = -1, -1 \not \in \mathbb{N})\)

Let \(C(x, s)\) mean that \(s\) is closed upon \(x\)

Let \(f(n_1,n_2,\dots,n_x)\) be some arbitrary operation with \(n\) operands

Let \(A\) be some arbitrary set

Let \(C(x, s)\) mean that \(s\) is closed upon \(x\)

Let \(f(n_1,n_2,\dots,n_x)\) be some arbitrary operation with \(n\) operands

Let \(A\) be some arbitrary set

\((\forall x_1,x_2,\dots,x_n \in A)[f(x_1,x_2,\dots,x_n) \in A \Rightarrow C(f,A)]\)

if \(f(x) = x^2\), is \(f\) closed on the following

  • \(\mathbb{N}\)
  • \(\mathbb{R}\)
  • \(\mathbb{Z}^{\le 2}\)

Is \(\{1,0\}\) closed on \(\land\)?

Is \(\{0\}\) closed on \(\land\)?

Is \(\{0,1,2\}\) closed on Multiplication?

Is \(\mathbb{Z}\) closed on Division?