2.3: Primes, Composites, and Divisibility
- Page ID
- 205272
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
Encryption, which is needed for the secure exchange of information (i.e., online banking or shopping) is based on prime numbers. Encryption uses a composite number that is the product of two very large prime numbers. To break the encryption, the two primes that were used to form the composite number need to be determined. If the two prime numbers used are sufficiently large, even the fastest computer cannot determine those two prime numbers in a reasonable amount of time. It would take a computer 300 trillion years to crack the current encryption standard.
Applying Divisibility Rules
Before we begin our investigation of divisibility, we need to know some facts about important sets of numbers:
- The counting numbers are also called the natural numbers. This set of numbers, \(\{1,2,3,4, \ldots\}\), is denoted with the symbol \(\mathbb{N}\).
- Another important set of numbers is the integers. The integers are the natural numbers, along with 0, and the negatives of the natural numbers. This set is often written as \(\{\ldots,-3,-2,-1,0,1,2,3, \ldots\}\). We denote the integers with the symbol \(\mathbb{Z}\).
- Notice that \(\mathbb{N}\) is a proper subset of \(\mathbb{Z}\), or, \(\mathbb{N} \subset \mathbb{Z}\). All the ideas of this section apply to the natural numbers, while only some apply to all the integers.
Divisibility is when the integer \(a\) is divided by \(b\), and there is no remainder. We called \(b\) divisor of \(a\). Or \(b\) is a factor of \(a\).
There are many occasions when separating items into equal groups comes into play to ensure an equal distribution of whole items. For example, Francis, a preschool art teacher, has \(15\) students in one class. Francis has \(225\) sheets of construction paper and wants to give each student an equal number of sheets. To know if he will use all the construction paper, Francis is really asking if \(225\) can be evenly divided into \(15\) groups.
| Divisor | Rule |
|---|---|
| \(2\) | Last digit is even |
| \(3\) | Add the digits of the number together. If that sum is divisible by \(3\) , then so is the original number |
| \(4\) | Look at only the last two digits. If this number is divisible by \(4\) , so is the original number |
| \(5\) | Look at only the last digit. If it is a \(5\) or a \(0\) , then the original number is divisible by \(5\) |
| \(6\) | If the number passes the rule for divisibility by \(2\) and for \(3\) , then the number is divisible by \(6\) |
| \(7\) | Take the last digit of a number, double it, and subtract that result from the rest of the number. If the new number is divisible by \(7\), the original number is divisible by \(7\). |
| \(8\) | Look at the last three digits. If this number is divisible by \(8\), then the original number is. |
| \(9\) | Add the digits of the number together. If that number is divisible by \(9\) , then so is the original number |
| \(10\) | Look at only the last digit. If it is a \(0\), then the original number is divisible by \(10\). |
| \(12\) | If the number passes the rule for \(3\) and \(4\) , the number is divisible by \(12\) |
Example \(\PageIndex{1}\): Using Divisibility Rules
- Using divisibility rules, determine if \(245\) is divisible by \(5\).
- Using divisibility rules, determine if \(25,983\) is divisible by \(9\).
- Using divisibility rules, determine if \(1,946\) is divisible by \(7\).
- Answer
-
- The number here to examine is to find out if the last digit of the number. Since the last digit is a \(5\), the number \(2455\) is divisible by \(5\) because the rule states if the last digit of the number is a \(5\) or a \(0\), then the original number is divisible by \(5\).
- The divisibility rule for \(9\) is that when the digits of the number are added, the sum is divisible by \(9\). So, we calculate the sum of the digits.\(2+5+9+8+3=27\). Since \(27\) is divisible by \(9\) , so is the original number \(25,983\) . Here \(27\) is the number you need to examine to see if the number is divisible by \(3\) or not.
- Last digit is \(6\). Double of \(6\) is \(12\). Now \(194-12=182\). Repeat the same process. Double of \(2\) is \(4\). Now \(18-4=14\). \(14\) is a multiple of \(7\). Therefore, \(1946\) is divisible by \(7\).
Prime and Composite Numbers
Sometimes, a natural number has only two unique divisors, \(1\) and itself. For instance, \(7\) and \(19\) are prime. In other words, there is no way to divide a prime number into groups with an equal number of things, unless there is only one group, or those groups have one item per group. Other natural numbers have more than two unique divisors, such as \(4\), or \(26\). These numbers are called composite. The number \(1\) is special; it is neither prime nor composite.
To determine if a number is prime or composite, you have to determine if the number has any divisors other than \(1\) and itself. The divisibility rules are useful here and can quickly show you if a number has a divisor on that list.
However, if none of those divide the number, you still have to check all other possible prime divisors. What are the prime numbers that are possibly divisors of the number you are checking? You need only check the prime numbers up to the square root of the number in question. For instance, if you want to know if \(2,117\) is prime, you need to determine if any primes up to the square root of \(2,117\) (which is \(46.0\) when rounded to one decimal place) divide \(2,117\). If any of those primes are divisors of the number in question, then the number is composite. If none of those primes work, then the number is itself prime.
We can check divisibility with whatever tool we wish. Divisibility rules are quick for some prime divisors (\(2\) and \(5\) come to mind) but aren't quick for other values (like 11). In place of divisibility rules, we could just use a calculator. If the prime number divides the number evenly (that is, there is no decimal or fractional part), then the number is divisible by that prime. Table \(\PageIndex{1}\) is a quick list of the prime numbers up to \(6\). There are \(15\) prime numbers less than \(50\) .
| \(2\) | \(3\) | \(5\) | \(7\) | \(9\) |
| \(11\) | \(13\) | \(17\) | \(19\) | \(23\) |
| \(29\) | \(31\) | \(37\) | \(41\) | \(43\) and \(47\) |
Example \(\PageIndex{2}\): Determining if a Number Is Prime or Composite
Determine if \(423\) is prime or composite.
- Answer
-
The square root of \(423\) is \(20.57\) (rounded to two decimal places). So, we need to check if \(423\) is divisible by any prime up to \(20\).
Step 1: Check \(2\). We can tell \(423\) is not divisible by \(2\), as the last digit isn't even.
Step 2: Check \(5\). It is not divisible by \(5\) (the last digit isn't \(0\) or \(5\)).
Step 3: Check \(3\). To check if \(423\) is divisible by \(3\), we use the divisibility rule for \(3\). When we take the sum of the digits of \(423\), the result is \(9\). Since \(9\) is divisible by \(3\), so is \(423\).
Since \(423\) is divisible by \(3\), then \(423\) is a composite number. Writing \(423\) as the product of \(3\) and another natural number, \(141\) Or
\(423
= 3\ times 141 \) .
Large primes are a hot commodity. Using two very large primes (some have more than \(22\) million digits!) is necessary for secure encryption. Anyone who has a new prime that is large enough can use that prime to create a new encryption. Of course, whoever discovers a large prime could sell it to a security company. These primes are so useful for encryption that it is necessary to protect that intellectual property. In fact, at least one prime number was declared illegal.
Finding the Prime Factorization of Composite Numbers
Before we can start with prime factorization, let’s remind ourselves what it means to factor a number. We factor a number by identifying two (or more) numbers that, when multiplied, result in the original number. For instance, \(3\) and \(24\), when multiplied, give \(72\). So, \(72\) can be factored \(3\times24\). Notice that we could have factored the \(72\) differently, say
\[\begin{aligned}
72&=6\times12\\
72&=18\times4\\
72&=6\times4\times3\\
72&=2\times2\times2\times3\times3
\end{aligned} \nonumber \]
Finding the prime factorization of a composite number means writing the number as the product of all of its prime factors. For example, \[80=2\times2\times2\times2\times5\nonumber\]. Notice that all the numbers being multiplied on the right-hand side are prime numbers. Sometimes, prime numbers repeat themselves in the factorization. When prime factors do repeat, we may write the prime factorization using exponents, as in \(80=2^4\times5\).
Two forms of prime factorization
Expanded from\[80=2\times2\times2\times2\times 5\nonumber\]
Exponential form: \[80=2^4\times 5\nonumber\]
One has to wonder if finding the prime factorization could result in different factorizations. The Fundamental Theorem of Arithmetic tells us that there is only one prime factorization for a given natural number.
Fundamental Theorem of Arithmetic
Every natural number, other than \(1\), can be expressed in exactly one way, apart from the arrangement, as a product of primes.
The process of finding the prime factorization of a number is iterative, which means we do a step, then repeat it until we cannot do the step any longer. The step we use is to identify one prime factor of the number, then write the number as the prime factor times another factor. We repeat this step on the other, newly found, factor. This step is repeated until no more primes can be factored from the remaining factor.
Factor Trees
A useful tool for helping with prime factorization is a factor tree. To create a factor tree for the natural number \(n\) (where \(n\) not \(1\)), perform the following steps:
Step 1: If \(n\) is prime, you're done. If \(n\) is composite, continue to the next step.
Step 2: Identify two divisors of \(n\), all them \(a\) and \(b\).
Step 3: Write the number \(n\) down, and draw two branches extending down (or to the right) of the number \(n\).
Step 4: Label the end of one branch as seen in Figure \(\PageIndex{3}\).
Step 5: If \(a\) and \(b\) are prime, the tree is complete. When a number at this step is a prime number, we refer to it as a leaf of the tree diagram.
Step 6: If either\(a\) is \(b\) composite, repeat Steps \(2\) through \(4\) for \(a\) and \(b\)
Step 7: The process stops when the leaves are all prime.
Step 8: The prime factorization is then the product of all the leaves.
Example \(\PageIndex{3}\): Finding Prime Factorization
Find the prime factorization of \(66\).
- Answer
-
Since \(66\) is even, \(2\) is a factor.
Step 1: Factor out the \(2\). The factorization is \(66=2\times33\).
Figure \(\PageIndex{4}\) Since Figure \(2\) is a factor, that branch is done, and \(2\) is a leaf.
Step 2: The \(33\) , though, is divisible by \(3\), and is the product of \(3\) and \(11\) . We attach that to the factor tree.
Figure \(\PageIndex{5}\) Since the \(2\), \(3\), and \(11\) are all prime, the factor tree is done.
The prime factorization of \(66\) is the product of the leaves, \(66=2\times3\times11\). The factorization is complete.
Example \(\PageIndex{4}\): Finding the Prime Factorization
Find the prime factorization of \(135\).
- Answer
-
The number \(135\)is divisible by \(3\), and so \(3\) is a factor of \(135\).
Step 1: Factor out the \(3\). The factorization is \(135=3\times45\)
Figure \(\PageIndex{6}\)shown in Figure \(\PageIndex{6}\) \(45\) is also divisible by \(3\).
Step 2: Factor out a \(3\) from \(45\). The other factor is \(15\). The factor tree is shown in Figure \(\PageIndex{7}\).
Figure \(\PageIndex{7}\) \(15\) is also divisible by \(3\).
Step 3: The factors of \(15\) are \(3\) and \(5\). The factor tree is shown in Figure \(\PageIndex{8}\).
Figure \(\PageIndex{8}\) All the leaves are prime, so the process is complete. The prime factorization of \(135\) is \(3^5\times5\).
Finding the Greatest Common Divisor
Two numbers often have more than one divisor in common (all pairs of natural numbers have the common divisor 1). When listing the common divisors, it’s often the case that the largest is of interest. This divisor is called the greatest common divisor and is denoted GCD. It is also sometimes referred to as the greatest common factor (GCF).
For instance, \(6\) is the greatest common divisor of \(12\) and \(18\). We can see this by listing all the divisors of each number and, by inspection, selecting the largest value that shows up in each list.
| The divisors of \(12\) | \(1, 2, 3, 4, 6, 12\) |
| The divisors of \(18\) | \(1, 2, 3, 6, 9, 18\) |
It is easy to see that \(6\) is the greatest value that appears in both lists.
Example \(\PageIndex{5}\): Finding the Greatest Common Factor Using Lists
Find the greatest common divisor of \(400\) and \(250\) by listing all divisors of each number.
- Answer
-
We create a list of all the divisors of \(400\) and of \(250\), and choose the largest one.
The divisors of \(400\) are
\(1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 80, 100, 200\).
The divisors of \(250\) are
\(1, 2, 5, 10, 25, 50, 125, 250\).
The largest value that appears on both lists is \(50\), so the greatest common divisor of \(400\) and \(250\) is \(50\).
Listing all the divisors of the numbers in the set will always work, but for some relatively small numbers, the set of all divisors can become pretty big, and finding them all can be a chore. Another approach to finding the greatest common divisor is to use the prime factorization of the numbers. To do so, use the following steps:
Step 1: Find the prime factorization of the numbers.
Step 2: Identify the prime factors that appear in every number’s prime factorization. These are called the common prime factors.
Step 3: Identify the smallest exponent of each prime factor identified in Step \(2\) in the prime factorizations.
Step 4: Multiply the prime factors identified in Step \(2\) raised to the powers identified in Step \(3\). The result is the greatest common divisor.
Example \(\PageIndex{6}\): Finding the Greatest Common Divisor Using Prime Factorization
Find the greatest common divisor of \(24\) and \(90\) by using their prime factorizations.
- Answer
-
Step 1: Find the prime factorizations of the numbers.
The prime factorization of \(24\) is \(2^3\times 3\)
The prime factorization of \(90\) is \(2\times 3^2\times 5\)Step 2: Identify the prime factors that appear in every number’s prime factorization.
There is only one common prime factor, \(2\) and \(3\).
Step 3: Identify the smallest exponent of each prime from those identified in Step \(2\) in the prime factorizations.
The exponent of \(2\) in the prime factorization of \(24\) is \(3\). The exponent of \(2\) in the prime factorization of \(90\) is \(1\). So, the smallest exponent of \(2\) is \(1\). The exponent of \(3\) in the prime factorization of \(24\) is \(1\). The exponent of \(3\) in the prime factorization of \(90\) is \(2\). So, the smallest exponent of \(3\) is \(1\).
Step 4: Multiply the prime factors identified in Step \(2\) raised to the powers identified in Step \(3\).
This gives \(2^1\times 3^1 =6\)
Applications of the Greatest Common Divisor
The greatest common divisor has uses that are related to other mathematics (reducing fractions) but also in everyday applications. We’ll look at two such applications, which have very similar underlying structures. In each case, something must divide the groups or measurements equally.
Example \(\PageIndex{7}\): Party Bags
Sarah is planning a party. She has \(36\) candies and \(48\) toys to place in party favor bags. If she needs each party favor bag to be identical, what is the greatest number of party favor bags she can make? How many candies will be in each bag? How many toys will be in each bag?
- Answer
-
Since we want the greatest number of party favor bags, we need the GCD of \(38\) and \(48\).
Step 1: Find the prime factorizations of the numbers.
The prime factorization of \(36\) is \(2^2\times 3^2\)
The prime factorization of \(48\) is \(2^4\times 3\)
Step 2: Identify the prime factors that appear in every number’s prime factorization.
The common prime factors are \(2\) and \(3\).
Step 3: Identify the smallest exponent of each prime identified in Step \(2\) in the prime factorizations.
The smallest exponent for \(2\) in both prime factorization is \(2\) .
The smallest exponent for \(3\) in both prime factorization is \(1\) .
Step 4: Multiply the prime factors identified in Step \(2\) raised to the powers identified in Step \(3\).
This gives \(2^2\times 3^1=12\). The GCD of \(48\) and \(36\) is \(12\) , so the greatest number of party favor bags is \(12\).
Number of candies in each bag is \(\frac{36}{12}=3\).
The number of toys in each bag is \(\frac{48}{12}=4\).
Finding the Least Common Multiple
The flip side of a divisor of a number is a multiple of that number. For example, \(5\) is a divisor of \(45\) and so \(45\) is a multiple of \(5\). More generally, if the number divides the number , then is a multiple of .
This drives the idea of the least common multiple of a set of numbers. A common multiple of a set of numbers is a multiple of each of those numbers. For instance, \(45\) is a common multiple of \(9\) and \(5\), because \(45\) is a multiple of \(9\) (\(9\) divides \(45\)) and \(45\) is also a multiple of \(5\) (\(5\) divides \(45\)). The least common multiple (LCM) of a set of numbers is the smallest positive common multiple of that set of numbers.
There are (at least) three ways to find the LCM of a set of numbers, and we will explore two of them. One way is to create a list of multiples of each number in the set, and then identify the smallest multiple that appears in those lists.
Example \(\PageIndex{8}\): Finding the Least Common Multiple Using Lists
Find the LCM of \(24\) and \(90\) by listing multiples and choosing the smallest common multiple.
- Answer
-
Create a list of the multiples of each number.
Step 1: The first \(15\) multiples for \(24\) :
\(24, 48, 72, 96, 120, 144, 168, 192, 216, 240, 264, 288, 312, 336, 360\).
Step 2: The first \(15\) multiples for \(90\):
\(90, 180, 270, 360, 450, 540, 630, 720, 810, 900, 990, 1080, 1170, 1260, 1350\).
There is one multiple common to these lists: \(360\). So,\(360\) is the LCM of \(24\) and \(90\).
The second method we can use is to find the prime factorizations of the numbers in the set and build the LCM based on their prime divisors. The LCM can be built from the prime factorizations of the numbers in the set, in a similar way to finding the greatest common divisor. Here are the steps for using the prime factorization method to find the LCM.
Step 1: Find the prime factorization of each number.
Step 2: Identify each prime that appears in any prime factorization.
Step 3: Identify the largest exponent of each prime identified in Step \(2\) in the prime factorizations.
Step 4: Multiply the prime factors identified in Step \(2\) raised to the powers identified in Step \(3\).
Example \(\PageIndex{9}\): Finding the Least Common Multiple Using Prime Factorization
Use the prime factorizations of \(24\) and \(90\) to identify their LCM.
- Answer
-
Step 1: Find the prime factorization of each number.
\[24=2^3\times3\nonumber\]
\[90=2\times 3^2\times5\nonumber\]Step 2: Identify each prime that appears in any prime factorization.
The prime numbers present in the prime factorizations are \(2\), \(3\), and \(5\).
Step 3: Identify the largest exponent of each prime identified in Step \(2\) in the prime factorizations.
Prime \(2\) \(3\) \(5\) Largest exponent \(3\) \(2\) \(1\) Step 4: Compute the LCM by multiplying the prime factors identified in Step \(2\) raised to the powers identified in Step \(3\).
The LCM for \(24\) and \(90\) \[2\times2\times2\times3\times3\times5=2^3\times3^2\times5\nonumber\]
Applications of the Least Common Multiple
Some applications of LCM involve events that repeat at fixed intervals, such as visits to a location. Other applications involve ensuring equal magnitudes when using parts of different sizes. In each case, we may be looking to determine when two processes “line up.”
Example \(\PageIndex{10}\): Application of LCM
Alejandra is buying chocolate chip cookies and snickerdoodles for a class reunion. Each package of chocolate chip cookies contains \(12\) chocolate chip cookies. Each package of snickerdoodles contains \(16\) snickerdoodles. What is the least number of each kind of cookie she must buy to have an equal number of each? How many packages of chocolate chip cookies and snickerdoodles does she need to buy?
- Answer
-
This is an example where the least number of each kind of cookie she must buy to have an equal number of each.
If we list the days that each student will volunteer, it becomes clear that we could solve this problem using the LCM of \(12\)and \(16\).
Multiple of \(12\) are \(12, 36, 48, 60, 72, 48\cdots\)
Multiple of \(16\) are \(16, 32, 48, 64,\cdots48\).
The smallest number appearing on both lists is \(48\). So she must buy 48 of each kind of cookies. She needs to buy \(\frac{48}{12}=4\) packages of chocolate chip cookies and \(\frac{36}{12}=3\) packages of snickerdoodles.


