Math 170 Project Part 2

Download Report

Transcript Math 170 Project Part 2

Math 170 Project Part 2
Section 4.6
Section 9.3
Section 9.6
#33
#29
#18
By: Marlene Reyna and
Guadalupe Esquivel
Section 4.6 #33
Eratosthenes
•
•
•
•
He was born in 276 BC in
Shahhat, Libya.
He was a Greek mathematician,
geographer and astronomer.
In number theory, he introduced
the sieve of Eratosthenes, an
efficient method of identifying
prime numbers.
He died in 194 BC in Alexandria,
Egypt.
Section 4.6 #33
The sieve of Eratosthenes provides a way to find all prime numbers less than or equal
to some fixed number n. To construct it, write out all the integers from 2 to n. Cross
out all multiples of 2 except 2 itself, then all multiples of 3 except 3 itself, then all
multiples of 5 except 5 itself, and so forth. Continue crossing out the multiples of each
successive prime number up to √n. The numbers that are not crossed out are all the
prime numbers from 2 to n.
Here is a sieve of Eratosthenes that includes the numbers from 2 to 27. The multiples
of 2 are crossed out with a /, the multiples of 3 with a \, and the multiples of 5 with a
—.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25 26 27
Use the sieve of Eratosthenes to find all prime numbers less
than 100
Without multiples of 2
1235 7 9
21 23 25 27 29
31 33 35 37 39
41 43 45 47 49
51 53 55 57 59
61 63 65 67 69
71 73 75 77 79
81 83 85 87 89
91 93 95 97 99
Without multiples
of 3 and 5
Without multiples
of 7 and 11
12357
11 13 17 19
23 29 31 37
41 43 47 49
53 59 61 67
71 73 77 79
83 89 91 97
12357
11 13 17
19
23 29 31
37
41 43 47
53 59 61
67
71 73 79
List of all prime numbers
less than 100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43
47 53 59 61 67 71 73 79 83 89 97
Section 9.3
#29 Refer to Example 9.3.5
Example 9.3.5 Internet Addresses
An example of an IP address is 10001100 11000000 00100000 10001000, where the 32 bits
have been divided into four groups of 8 for easier reading. To make the readings even
easier, IP addresses are normally written as “dotted decimals,” in which each group of 8
bits is converted into a decimal number between 0 and 255. For instance, the IP address
above converts into 140.192.32.136.
In order to accommodate the various sizes of the local networks connected through the
Internet, the network IDs are divided into several classes, the most important of which are
called A, B, and C. In every class, a host ID may NOT consist of either all 0’s or all 1’s.
Class A network IDs are used for very large local networks. The left-most bit
is set to 0, and the left-most 8 bits give the full network ID. The remaining 24 bits are used
for individual host IDs. However, neither 00000000 nor 01111111 is allowed as a
network ID for a class A IP address.
Class B network IDs are used for medium to large local
networks. The two left-most bits are set to 10, and the left-most 16
bits give the full network ID. The remaining 16 bits are used for
individual host IDs.
Class C network IDs are used for small local networks. The three leftmost bits are set to 110, and the left-most 24 bits give the full network ID. The
remaining 8 bits are used for individual host IDs.
a. Write the following IP address in dotted decimal form:
11001010 00111000 01101011 11101110
27 26 25 24 23 22 21 20 27 26 25 24 23 22 21 20 27 26 25 24 23 22 21 20 27 26 25 24 23 22 21 2
1 1 0 0 1 0 1 0 0 0 1 1 1 0 0 0
0 1 1 0 1 0 1 1 1 1 1 0 1 1 1 0
27+26+23+21
26+25+23+21+20
=202
25+24+23
27+26+25+23+22+21
=56
=107
=238
Ans: 202.56.107.238
b. How many Class A networks can there be?
The network ID for a Class A network consists of 8 bits and begins with 0. There are two
choices for each of the remaining 7 positions meaning that the total number of possible
network IDs is 27 but because neither 00000000 nor 01111111 is allowed, the total is
c. What is the dotted decimal form of the IP address for a computer in a Class
A network?
w
x
Let w.x.y.z be the dotted decimalyform of the IP address for azcomputer in a Class A
network. Since neither 00000000 nor 0111111 is allowed as a network ID for a Class A
IP address, the Network ID part of a Class A IP address goes from
00000001 to 01111110 .
1
to
126
This means that w can be any integer from 1 through 126. The remaining variables x,y,z,
which correspond to the Host ID for a Class A IP address, can be any integer from:
00000000
to 11111111
0
255
to
However, x, y, and z can’t all be 0 or 255 since a host ID may NOT consist of either all 0’s
or all 1’s.
Ans: The dotted decimal form of the IP address for a computer in a Class A network is
d. How many host IDs can there be for a Class A network?
For a class A network, 24 bits are used for host IDs. Having two choices (either 0 or 1) for
each of 24 positions gives a total of 216 host IDs. But because two of these are NOT
allowed (all 0’s and all 1’s), the total number of host IDs is 216 - 2.
e. How many class C networks can there be?
The network ID for a Class C network consists of 24 bits and begins with 110. Because
there are two choices for each of the remaining 21 positions (either 0 or 1), the total
number of possible network IDs is 221.
f. What is the dotted decimal form of the IP address for a computer in a Class C network?
Let w.x.y.z be the dotted decimal form of the IP address for a computer in a Class C
network. The network ID part of a Class C IP address goes from
11000000
00000000 =
00000000
=
192
w
x
y
z
0
to
=0
11011111
11111111 11111111.
=
=
220
255 = 255
As dotted decimals, these numbers range from 192.0.0 to 220.255.255. This means that
192 ≤ w ≤ 220, 0 ≤ x ≤ 255, 0 ≤ y ≤ 255. Since z is the host ID, it must go from
00000001 to 11111110 since a host ID may NOT consist of either all 0’s or all 1’s. This
means that 1 ≤ z ≤ 254.
Ans: w.x.y.z is the dotted decimal form of the IP address for a computer in a Class C
network
where 192 ≤ w ≤ 220, 0 ≤ x ≤255, 0 ≤ y ≤ 255, and 1 ≤ z ≤ 254.
G. How many host IDs can there be for a Class C network?
For a class C network, 8 bits are used for host IDs. Having two choices (either 0 or 1) for
each
of 8 positions gives a total of 28 host IDs. But because two of these are NOT allowed (all 0’s
h.
How can you tell, by looking at the first of the four numbers in the dotted
decimal form of an IP address, what kind of network the address is from?
Explain.
Assume w.x.y.z is the dotted decimal form of an IP address. If 1 ≤ w ≤ 126 then that means
that we are looking at a Class A network(Refer to problem C). If 192 ≤ w ≤ 220, then that
means that we are looking at a Class C network (Refer to problem F). If 128 ≤ w ≤ 191 then
that means that
=
=
we are looking at a Class B network since the network ID part of a Class B IP address goes
from
:
10000000 00000000
128
0
=
=
to
10111111 11111111
191
255
As dotted decimals, these numbers range from 128.0 to 191.255. This means that 128 ≤ w ≤
191.
I. An IP address is 140.192.32.136. What class of network does it come from?
It comes from a Class B network since the dotted decimal form of a Class B IP address is
w.x.y.z where 128 ≤ w ≤ 191.(Refer to problem h)
J. An IP address is 202.56.107.238. What class of network does it come from?
Section 9.6 #18
A large pile of coins consists of pennies, nickels, dimes and quarters.
a. How many different collections of 30 coins can be chosen if there are at
least 30 of each kind of coin?
b. If the pile contains only 15 quarters but at least 30 of each other coin, how
many collections of 30 coins can be chosen?
c. If the pile contains only 20 dimes but at least 30 of each other coin, how
many collections of 30 coins can be chosen?
d. If the pile contains only 15 quarters and only 20 dimes but at least 30 of
each other coin, how many collections of 30 coins can be chosen?
To solve the following problems we use combinations:
C(n,k)= n
=
n!
k
(n-k)! k!
a. How many different collections of 30 coins can be chosen
if there are at least 30 of each kind of coin?
There are 30 pennies, 30 nickels, 30 dimes and 30 quarters.
There are a total of 120 coins
C(120, 30)= 120! _
90! 30!
b. If the pile contains only 15 quarters but at least 30 of
each other coin, how many collections of 30 coins can be chosen?
There are a total of 105 coins in this pile.
C(105,30)= 105!
75! 30!
c. If the pile contains only 20 dimes but at least 30 of each other coin, how
many collections of 30 coins can be chosen?
There are a total of 110 coins in this pile
C(110,30)= 110! _
80! 30!
d. If the pile contains only 15 quarters and only 20 dimes but at least 30 of
each other coin, how many collections of 30 coins can be chosen?
There are a total of 95 coins in this pile
C(95,30)= 95! _
65! 30!
Bibliography
Eratosthenes Biography. (n.d). Retrieved November 16,2013, from Biography Base:
http://www.biographybase.com/biography/Eratosthenes.html