next up previous
Next: About this document Up: My Home Page

Divisibility

If n and d are integers and tex2html_wrap_inline245 , then n is divisible by d iff tex2html_wrap_inline251 for some integer k.

Alternate ways to say the same thing are:

Examples:

Properties of Divisibility

Claim: For all integers a, b, and c, if a divides b and b divides c, then a divides c.

Proof: By the definition of divisibility, tex2html_wrap_inline293 and tex2html_wrap_inline295 , for some integers r and s.

By substitution,

displaymath233

Since the product of two integers (r and s) is an integer, we have shown that a divides c with quotient tex2html_wrap_inline309 . height6pt width4pt

Claim: For all integers a and b, if tex2html_wrap_inline315 (i.e a divides b) and tex2html_wrap_inline321 , then a = b.

Counterexample: tex2html_wrap_inline325 and tex2html_wrap_inline327 !

Mod and Div

In integer division tex2html_wrap_inline329 , we get both a quotient q and a remainder r.

The quotient remainder theorem states that for any integer n and integer d > 0, tex2html_wrap_inline339 in only one way where tex2html_wrap_inline341 .

Why? Because tex2html_wrap_inline343 .

The div function returns the quotient of integer division.

The mod function returns the remainder of integers division.

Examples:

The last two follow from the quotient remainder theorem.

Applications of Mod and Div

Prime Numbers

An integer n is prime iff n > 1 and for all positive integers r and s such that tex2html_wrap_inline387 , then r=1 or s=1.

n is prime tex2html_wrap_inline395 tex2html_wrap_inline397 positive integers r, s, tex2html_wrap_inline403 or (s=1).

Note that 1 is, by definition, not prime.

An integer n is composite iff n > 1 and there exist positive integers r>1 and s>1, tex2html_wrap_inline415 .

The Unique Factorization Theorem or Fundamental Theorem of Arithmetic states that any integer n > 1 can be written uniquely as the product of prime numbers.

Examples: tex2html_wrap_inline419

tex2html_wrap_inline421

How Many Prime Numbers are There?

Primes are integers which have no non-trivial factors.

It seems like it should get harder and harder for large numbers to be primes, since any prime number less than n is a potential factor.

Certainly, prime numbers tend to get rarer and rarer as n gets larger.

There are 168 primes less than 1000, but only 135 primes from 1000 to 2000. There are 5133 primes less than 50,000, but only 4459 from 50,000 to 100,000.

Do the prime numbers eventually become so rare that we run out of them? Or are there an infinite number of primes?

Euclid's Proof

Euclid showed that there are an infinite number of prime numbers using an elegant proof by contradiction.

Every educated person should know Euclid's proof!

Assume the converse, that there are only a finite number of primes, tex2html_wrap_inline427 .

Let tex2html_wrap_inline429 , i.e. the product of all of these primes, plus one.

Since this is bigger than any of the primes on our list, m must be composite. Therefore some prime must divide it.

But which prime? m is not divisible by tex2html_wrap_inline435 , because it leaves a remainder of 1. m is not divisible by tex2html_wrap_inline439 , because it leaves a remainder of 1. In fact, m leaves a remainder of 1 when divided by any prime tex2html_wrap_inline443 , for tex2html_wrap_inline445 .

Thus tex2html_wrap_inline447 cannot be the complete list of primes, because m must therefore also be prime.

Since this contradicts the assumption that there is a complete list of primes, it means there cannot be a complete list; i.e. the number of primes is infinite!

Question: Suppose we take the first n primes, multiply them together, and add one. Does this number have to be prime?

Counterexample: We should expect it to be easier to find a counterexample for larger numbers, since primes are rarer and there is more room for for other prime factors.

displaymath236




next up previous
Next: About this document Up: My Home Page

Steve Skiena
Tue Aug 24 18:16:34 EDT 1999