INTG 002: Numbers and counting
D. DeTurck
University of Pennsylvania
February 17, 2014
D. DeTurck INTG 002 001 2014A:Numbers and counting 1 / 23
Numbers
• “God created the integers. All the rest is the work of man.” —L. Kronecker
• Number theory deals with the integers (or often just the positive integers).
• An important part of number theory involves the factors or divisors of numbers.
• Numbers that have no divisors other than 1 and themselves are called prime. The other numbers are called composite. (The number 1 is special, it is called a “unit”.)
• Primes are like the “atoms” of arithmetic, and composites are the “molecules”. But arithmetic is more complicated than chemistry because (Euclid) there are there are infinitely many prime numbers.
D. DeTurck INTG 002 001 2014A:Numbers and counting 2 / 23
Numbers
•“God created the integers. All the rest is the work of man.” —L. Kronecker
•Number theory deals with the integers (or often just the positive integers).
•An important part of number theory involves the factors or divisors of numbers.
•Numbers that have no divisors other than 1 and themselves are called prime. The other numbers are called composite. (The number 1 is special, it is called a “unit”.)
•Primes are like the “atoms” of arithmetic, and composites are the “molecules”. But arithmetic is more complicated than chemistry because (Euclid) there are there are infinitely many prime numbers.
D. DeTurck INTG 002 001 2014A:Numbers and counting 2 / 23
Fundamental Theorem of Arithmetic
• The fundamental theorem of arithmetic says that every number can be factored into primes in a unique way. • Examples:
30 = 2·3·5 120 = 23
·3·5 242 = 2·112
D. DeTurck INTG 002 001 2014A:Numbers and counting 3 / 23
Greatest Common Divisors
•In the egg problem, and when you add fractions, the idea of “greatest common divisor” comes up a lot. You can find it by comparing prime factorizations:
•Example: Find the GCD of 25,248 and 12,948. •Factoring these is tough!
25,248 = 25
·3·263 12,948 = 22 ·3·13·83
Euclidean Algorithm
• An easier way! The “Euclidean algorithm”: Keep dividing and getting quotient and remainder. Use the pattern shown here. When you get to zero, the last remainder was the GCD! • Example: Find the GCD of 25,248 and 12,948 •
25,248 = 1(12,948) + 12,300 12,948 = 1(12,300) + 648 12,300 = 18(648) + 636
Combinatorics – How to count without really doing it!
•There are three kinds of people in the world: Those who can count, and those who can’t.
•One fundamental counting principle that we will use over and over is the multiplication principle. It is a way of counting how many different ways there are to accomplish multiple independent tasks (independent means that it doesn’t matter what order the tasks are done).
•If there aren1ways to accomplish the first task, andn2ways
to accomplish the second task, and so on. . . , then the number of ways to accomplish all the tasks is the productn1n2· · ·.
D. DeTurck INTG 002 001 2014A:Numbers and counting 6 / 23
Examples
•For instnace, in the casino game of Blackjack, a two-card hand consisting of an ace and either a face card or a ten is called a “blackjack”. If a standard 52 card deck is used, then there are 64 different ”blackjacks”. (There are 4 aces and 16 “ten cards” and 4·16 = 64)
•As another example, there are 1024 different ways to fill in the answers on a ten-question true-false test (assuming every question is answered). This is because there are two ways to answer the first question, two ways to answer the second, and so on up to the tenth question, so the total number of ways to answer all the questions is the product
2·2·2·2·2·2·2·2·2·2 = 210= 1024.
•A question for you: How many ways are there to fill in the answers if it is allowed to leave some of them blank?
D. DeTurck INTG 002 001 2014A:Numbers and counting 7 / 23
Examples
•For instnace, in the casino game of Blackjack, a two-card hand consisting of an ace and either a face card or a ten is called a “blackjack”. If a standard 52 card deck is used, then there are 64 different ”blackjacks”. (There are 4 aces and 16 “ten cards” and 4·16 = 64)
•As another example, there are 1024 different ways to fill in the answers on a ten-question true-false test (assuming every question is answered). This is because there are two ways to answer the first question, two ways to answer the second, and so on up to the tenth question, so the total number of ways to answer all the questions is the product
2·2·2·2·2·2·2·2·2·2 = 210= 1024.
•A question for you: How many ways are there to fill in the answers if it is allowed to leave some of them blank?
D. DeTurck INTG 002 001 2014A:Numbers and counting 7 / 23
Examples
•For instnace, in the casino game of Blackjack, a two-card hand consisting of an ace and either a face card or a ten is called a “blackjack”. If a standard 52 card deck is used, then there are 64 different ”blackjacks”. (There are 4 aces and 16 “ten cards” and 4·16 = 64)
•As another example, there are 1024 different ways to fill in the answers on a ten-question true-false test (assuming every question is answered). This is because there are two ways to answer the first question, two ways to answer the second, and so on up to the tenth question, so the total number of ways to answer all the questions is the product
2·2·2·2·2·2·2·2·2·2 = 210= 1024.
•A question for you: How many ways are there to fill in the answers if it is allowed to leave some of them blank?
D. DeTurck INTG 002 001 2014A:Numbers and counting 7 / 23
A couple more examples
•Encore Travel, Inc. offers a “Theater Week in London” package originating from Philadelphia. There is a choice of eight flights per week, a choice of five hotel accommodations, and a choice of a ticket to one of eight shows. How many different such travel packages can one choose from?
•A psychologist has constructed the following maze for use in an experiment. The maze is constructed so that a rat must pass through a series of one-way doors. How many different paths are there from start to finish?
A couple more examples
•Encore Travel, Inc. offers a “Theater Week in London” package originating from Philadelphia. There is a choice of eight flights per week, a choice of five hotel accommodations, and a choice of a ticket to one of eight shows. How many different such travel packages can one choose from?
•A psychologist has constructed the following maze for use in an experiment. The maze is constructed so that a rat must pass through a series of one-way doors. How many different paths are there from start to finish?
Finding the number of divisors of
n
•This is an application of the multiplication principle. •For example, suppose we want to count the divisors ofn= 144. •Begin by forming the prime factorization of 144: 144 = 24·32. •Any divisor of 144 must be a product of some number of 2’s
(between 0 and 4) and some number of 3’s (between 0 and 2). So here’s a table of the possibilities:
20 21 22 23 24
30 1 2 4 8 16
31 3 6 12 24 48
32 9 18 36 72 144 From the table, there are 5 x 3 = 15 divisors of 144.
•In general, if you have the prime factorization of the numbern, then to calculate how many divisors it has, you take all the exponents in the factorization, add 1 to each, and then multiply these “exponents + 1”s together.
D. DeTurck INTG 002 001 2014A:Numbers and counting 9 / 23
Finding the number of divisors of
n
•This is an application of the multiplication principle. •For example, suppose we want to count the divisors ofn= 144. •Begin by forming the prime factorization of 144: 144 = 24·32. •Any divisor of 144 must be a product of some number of 2’s
(between 0 and 4) and some number of 3’s (between 0 and 2). So here’s a table of the possibilities:
20 21 22 23 24
30 1 2 4 8 16
31 3 6 12 24 48
32 9 18 36 72 144 From the table, there are 5 x 3 = 15 divisors of 144. •In general, if you have the prime factorization of the numbern,
then to calculate how many divisors it has, you take all the exponents in the factorization, add 1 to each, and then multiply these “exponents + 1”s together.
D. DeTurck INTG 002 001 2014A:Numbers and counting 9 / 23
Summing divisors
•The number of divisors ofnis denotedD(n) Now, we turn to the problem of finding a way to calculate the sumS(n) of all the divisors ofn.
•Example: Find the sum of the divisors ofn= 144. •Begin by forming the prime factorization of 144: 144 = 24·32
and the divisor table:
20 21 22 23 24 Row sum
30 1 2 4 8 16 31
31 3 6 12 24 48 93
32 9 18 36 72 144 279
Column sum 13 26 52 104 208 403
•In the table that the first column sum is 1 + 3 + 9 = 13. And the other column sums are 13·2, then 13·4, and so forth. •The total is the product of 1 + 2 + 4 + 8 + 16 = 31 with
1 + 3 + 9 = 13, i.e.,S(144) =S(24·32) =S(24)·S(32).
D. DeTurck INTG 002 001 2014A:Numbers and counting 10 / 23
Summing divisors
•The number of divisors ofnis denotedD(n) Now, we turn to the problem of finding a way to calculate the sumS(n) of all the divisors ofn.
•Example: Find the sum of the divisors ofn= 144. •Begin by forming the prime factorization of 144: 144 = 24·32
and the divisor table:
20 21 22 23 24 Row sum
30 1 2 4 8 16 31
31 3 6 12 24 48 93
32 9 18 36 72 144 279
Column sum 13 26 52 104 208 403
•In the table that the first column sum is 1 + 3 + 9 = 13. And the other column sums are 13·2, then 13·4, and so forth. •The total is the product of 1 + 2 + 4 + 8 + 16 = 31 with
1 + 3 + 9 = 13, i.e.,S(144) =S(24·32) =S(24)·S(32).
D. DeTurck INTG 002 001 2014A:Numbers and counting 10 / 23
Summing divisors
•In general, if you have the prime factorization of the number n, then to calculate the sum of its divisors, you take each different prime factor and add together all its powers up to the one that appears in the prime factorization, and then multiply all these sums together.
•Example: DetermineS(1800).
•Solution: The prime factorization of 1800 is 23 ·32
·52. And
S(23) = 1 + 2 + 4 + 8 = 15
S(32) = 1 + 3 + 9 = 13
S(52) = 1 + 5 + 25 = 31
ThereforeS(1800) = 15·13·31 = 6045.
Summing divisors
• In general, if you have the prime factorization of the number n, then to calculate the sum of its divisors, you take each different prime factor and add together all its powers up to the one that appears in the prime factorization, and then multiply all these sums together.
• Example: DetermineS(1800).
• Solution: The prime factorization of 1800 is 23 ·32
·52. And
A helpful formula
•One last thing that would help is to have a formula for calculating
S(pk) = 1 +p+p2+...+pk. Here it is:
S(pk) = 1 +p+p2+...+pk=pk+1−1
p−1 . •One for you: Calculate S(1,000,000).
D. DeTurck INTG 002 001 2014A:Numbers and counting 12 / 23
Combinatorics II – Putting things in order
• Another application of the counting principle is the idea of permutations — A permutation of a list is a rearrangement of it. And it makes sense to ask how many rearrangements a list has – or how many permutations a set has.
• For example, the list
•Vanilla
•Chocolate
•Strawberry
has six different permutations:
•V,C,S
•V,S,C
•C,V,S
•C,S,V
•S,V,C
•S,C,V
D. DeTurck INTG 002 001 2014A:Numbers and counting 13 / 23
Applying the multiplication principle
•Sometimes the word arrangements is used instead of permutations when speaking about ordered lists from a specified set that do not necessarily contain all the members of the set. Theorem
An n-element set has n!permutations. More generally, the number of arrangements of k elements from a set of size n is the product: n(n−1)(n−2)...(n−k+ 1).
•To show that this is true, use the multiplication principle. There arenways to pick the first element of the list, then onlyn−1 ways to pick the second element, thenn−2 and so forth. If we’re listing all the elements, we get all the way down to 1 way to pick the last element, son! is the number of arrangements. If we’re only pickingkof the elements, then we get down only to (n−k+ 1) – convince yourself that this is so by considering a few examples.
D. DeTurck INTG 002 001 2014A:Numbers and counting 14 / 23
Applying the multiplication principle
•Sometimes the word arrangements is used instead of permutations when speaking about ordered lists from a specified set that do not necessarily contain all the members of the set. Theorem
An n-element set has n!permutations. More generally, the number of arrangements of k elements from a set of size n is the product: n(n−1)(n−2)...(n−k+ 1).
•To show that this is true, use the multiplication principle. There arenways to pick the first element of the list, then onlyn−1 ways to pick the second element, thenn−2 and so forth. If we’re listing all the elements, we get all the way down to 1 way to pick the last element, son! is the number of arrangements. If we’re only pickingkof the elements, then we get down only to (n−k+ 1) – convince yourself that this is so by considering a few examples.
D. DeTurck INTG 002 001 2014A:Numbers and counting 14 / 23
Examples
•A problem for you: In how many ways can the names of six candidates for political office be listed on a ballot?
•Another problem for you! Solve the Baskin-Robbins problem: If there are 31 flavors, then how many different 3-scoop cones are possible?
•One more: A club has 10 members. How many ways can the club choose four of its members to be President, Vice President, Secretary and Treasurer?
Examples
• A problem for you: In how many ways can the names of six candidates for political office be listed on a ballot? • Another problem for you! Solve the Baskin-Robbins problem:
If there are 31 flavors, then how many different 3-scoop cones are possible?
• One more: A club has 10 members. How many ways can the club choose four of its members to be President, Vice President, Secretary and Treasurer?
Examples
•A problem for you: In how many ways can the names of six candidates for political office be listed on a ballot? •Another problem for you! Solve the Baskin-Robbins problem:
If there are 31 flavors, then how many different 3-scoop cones are possible?
•One more: A club has 10 members. How many ways can the club choose four of its members to be President, Vice President, Secretary and Treasurer?
D. DeTurck INTG 002 001 2014A:Numbers and counting 15 / 23
Combinatorics III — Making choices
• The handshake problem: Five people come to a meeting, and everybody shakes hands with everybody else. How many handshakes occur? At first you might think it’s 20 = 5·4, but it’s actually 10 = 5·4/2.
• This is the idea behind combinations. These are “selections” or “subsets” chosen from a big set without regard to order.
D. DeTurck INTG 002 001 2014A:Numbers and counting 16 / 23
Combinations
•For example, if there are 4 flavors: Vanilla, Chocolate, Strawberry and Pistachio, then you could make the following orders of 3-flavor bowls of ice cream (I take the position that with cones the order from top to bottom matters, but for bowls it does not. Sue me.):
•V,C,S
•V,C,P
•V,S,P
•C,S,P
So there are four different ways to choose three elements from a four-element set. This number is calledC(4,3). To calculate it, we can take all the different ways to pick an ordered list of three elements from four, which is 4·3·2 = 24, and then divide by the number of times we will have counted each choice, which is the number of ways of rearranging a three-element list, or 3! = 6. And 24/6 = 4, as it should.
D. DeTurck INTG 002 001 2014A:Numbers and counting 17 / 23
Calculating
C
(
n
,
k
)
•In general, the way to calculateC(n,k) is:C(n,k) =n(n−1)· · ·(n−k+ 1) k!
•The numbersC(n,k) are called binomial coefficients – we’ll learn why later on.
•These numbers come up in the famous “Pascal’s triangle”, which looks like this:
C(0,0)
C(1,0) C(1,1)
C(2,0) C(2,1) C(2,2)
C(3,0) C(3,1) C(3,2) C(3,3)
C(4,0) C(4,1) C(4,2) C(4,3) C(4,4)
•When we fill in the numbers it looks like this: 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Notice that each number in the triangle is the sum of the two immediately above it.
D. DeTurck INTG 002 001 2014A:Numbers and counting 18 / 23
Examples
•OK – an example: How many 5-card poker hands are there (from
a standard 52-card deck)?
•Solution: Since the order of the five cards doesn’t matter, the
answer to this problem is simply C(52,5). To calculate this: C(52,5) =52·51·50·49·48
5·4·3·2·1 = 13·17·5·49·48 = 2,598,960
•Your turn: In how many ways can a member of a hiring
committee select 3 of 12 job applicants for further consideration?
•And another: Solve the Baskin-Robbins problem for bowls: If
there are 31 flavors, then how many different 3-scoop bowls are possible?
•One more: Twelve graduate students have applied for three
available teaching assistantships. In how many ways can the assistantships be awarded among these applicants if there are seven male and five female applicants and it is stipulated that at least one woman must be awarded an assistantship?
Examples
•OK – an example: How many 5-card poker hands are there (from
a standard 52-card deck)?
•Solution: Since the order of the five cards doesn’t matter, the
answer to this problem is simply C(52,5). To calculate this: C(52,5) =52·51·50·49·48
5·4·3·2·1 = 13·17·5·49·48 = 2,598,960
•Your turn: In how many ways can a member of a hiring
committee select 3 of 12 job applicants for further consideration?
•And another: Solve the Baskin-Robbins problem for bowls: If
there are 31 flavors, then how many different 3-scoop bowls are possible?
•One more: Twelve graduate students have applied for three
available teaching assistantships. In how many ways can the assistantships be awarded among these applicants if there are seven male and five female applicants and it is stipulated that at least one woman must be awarded an assistantship?
Examples
•OK – an example: How many 5-card poker hands are there (from
a standard 52-card deck)?
•Solution: Since the order of the five cards doesn’t matter, the
answer to this problem is simply C(52,5). To calculate this: C(52,5) =52·51·50·49·48
5·4·3·2·1 = 13·17·5·49·48 = 2,598,960
•Your turn: In how many ways can a member of a hiring
committee select 3 of 12 job applicants for further consideration?
•And another: Solve the Baskin-Robbins problem for bowls: If
there are 31 flavors, then how many different 3-scoop bowls are possible?
•One more: Twelve graduate students have applied for three
available teaching assistantships. In how many ways can the assistantships be awarded among these applicants if there are seven male and five female applicants and it is stipulated that at least one woman must be awarded an assistantship?
D. DeTurck INTG 002 001 2014A:Numbers and counting 19 / 23
Abundant, deficient and perfect numbers
•Numbers can be classified in many ways. They are either even or
odd, prime or composite (or 1), they may have more or less than 12 divisors, etc. A classification that was introduced by the ancient Greeks (who ascribed mystical properties to numbers), and that has proved interesting in more modern studies of number theory from a mathematical perspective, involves the sum of the divisors of a number. The Greeks thought about divisors of a number as the “parts” of the number, and so they did not consider the number to be a part of itself. So we need one more new idea (not a toughie!):
•Proper divisors: A numberxis aproper divisorofyprovided that
xis a divisor ofyandxis less thany.
•So the only “improper” divisor of a number is the number itself;
all other divisors are proper. The Greeks classified numbers according to the sums of their proper divisors.
•We’ll writeP(n) for the sum of all the proper divisors of the
numbern.
•Example:P(15) = 9, because the proper divisors of 15 are 1, 3,
and 5, and 1 + 3 + 5 = 9.
D. DeTurck INTG 002 001 2014A:Numbers and counting 20 / 23
Calculating
P
(
n
)
•The problem with the sum of proper divisors is thatP(n) does not have the nice multiplicative property thatS(n), the sum of all the divisors, had. But we can still computeP(n) pretty easily, using the formula forS(n) — since the only difference is that we don’t add theninP(n). Therefore:
P(n) =S(n)−n
•Example: Let’s computeP(1800). To do this, first we’ll compute S(1800) and then subtract off 1800. Start with the prime factorization 1800 = 23·32·52. Then calculate:
1 + 2 + 22 + 23 = 15 1 + 3 + 32 = 13,and 1 + 5 + 52 = 31.
•ThereforeS(1800) = (15)(13)(31) = 6045. This is the sum of all the divisors of 1800 (including 1800 itself). To getP(1800), we just subtract off the 1800 and get that
P(1800) =S(1800)−1800 = 6045−1800 = 4245.
D. DeTurck INTG 002 001 2014A:Numbers and counting 21 / 23
Greek distinctions
• The Greeks observed an interesting distinction, that you can observe in the two examples above. First, it’s not at all surprising thatP(1800) is much larger thanP(15), but it’s noteworthy thatP(1800) is in fact larger than 1800, whereas P(15) is smaller than 15. This leads to the Greek classification of numbers as follows:
•IfP(n)>n, thennis called anabundant number.
•IfP(n)<n, thennis called adeficient number.
•IfP(n) =n, thennis called aperfect number.
• This all has a “Goldilocksesque” character to it — but you shouldn’t think of “deficient” in any perjorative sense, or “perfect” in a good sense. Just accept and use the words, since they’re ingrained in the literature.
D. DeTurck INTG 002 001 2014A:Numbers and counting 22 / 23
A couple of problems for you
•Classify the numbers 28, 50, 120 and 4173 as being abundant, deficient, or perfect. You might find the Prime Factorization Calculator helpful.
•Are prime numbers abundant, deficient or perfect? •Show that every multiple of 12 is abundant. (Hint: A multiple
of 12 can be written as 12nfor some numbern. Find enough proper divisors of 12nto add up to more than 12n. It’s ok if you don’t find them all, since adding the ones you don’t find can only makeP(12n) bigger.) This shows there are infinitely many abundant numbers.
•This week for homework, one question you’ll consider is whether there are any odd abundant numbers. •And next week we’ll zero in on the perfect numbers.