Counting for Fun, Random Problems

Problem 1
Telephone numbers in North America follow the North American Numbering Plan (NANP). How many of these telephone numbers exist? The numbering system consists of three parts: a three-digit area code, a three-digit exchange code, and a four-digit subscriber number. The general format of these numbers is NXX NXX XXXX, where N is a digit ranging from 2 to 9 and X is a digit ranging from 0 to 9.

The format of the area code and the exchange code are the same. By the Rule of Product, the total number of these codes are N times X times X, or 8 · 10 · 10, or 800 codes each. The subscriber number is 10^4, or 10,000.

Now we extend the Rule of Product onto these three codes. The total number of telephone numbers is 800 · 800 · 10,000 = 6,400,000,00.

 

Problem 2
A website enforces a password system which mandates eight to twelve characters, one uppercase letter, one lowercase letter, one number, and one special character. The set of special characters includes !, #, $, %, and & for a total of five characters.

By the Rule of Sum, the total number of passwords is P_{8} + P_{9} + P_{10} + P_{11} + P_{12}, where P_{n} is the number of passwords with n characters.

There are 26 ways to choose an uppercase letter, 26 ways to choose a lowercase letter, 10 ways to choose a number, and 5 ways to choose a special character. Therefore, by the Rule of Sum, the total number ways to choose a password character is 26 + 26 + 10 + 5, or 67 character choices. For a password of eight characters, by the Rule of Product we pick a mandatory uppercase letter (26 ways), a mandatory lowercase letter (26 ways), a mandatory number (10 ways), a mandatory special character (5 ways), and then four characters of any type (67 ways each). This comes out to be:
P_{8} = 26 · 26 · 10 · 5 · 26^4 = 15,445,788,800
P_{9} = 26 · 26 · 10 · 5 · 26^5 = 401,590,508,800
P_{10} = 26 · 26 · 10 · 5 · 26^6 = 10,441,353,228,800
P_{11} = 26 · 26 · 10 · 5 · 26^7= 271,475,183,948,800
P_{12} = 26 · 26 · 10 · 5 · 26^8 = 7,058,354,782,668,800
P_{total} = P_{8} + P_{9} + P_{10} + P_{11} + P_{12} = 7,340,688,356,144,000

 

Problem 3
The Internet Protocol version 4 (IPv4) has five classes of IP addresses, Class A, Class B, Class C, Class D, and Class E which are represented by a 32-bit value. How many possible IP addresses exist for Class C? A Class C IP address is composed of three parts. The first part has three static bits, 1, 1, and 0. This is followed by the network part which has 21 bits. Finally, a host part composed of 8 bits. Note that there is no such IP address that has a host part of all zeros, or all ones.

There is one way to select each of the first three bits. Next, there are 2^21 ways to choose the network part. Finally, there are 2^8 ways to choose the host part, but remember that a host part cannot have a bit value of all zeros or all ones, so by the Rule of Difference we will subtract those two bit values from the host part. So, applying the Rule of Product to the three IP address parts, we find that the number of Class C addresses is:
1 · 1 · 1 · 2^{21} · (2^8 - 2) = 2,097,406