Exercise 9.3.9. To test whether the number n is a prime, you divide n all the integers 1, 2, 3,... up to a, and see if any of them divides evenly. How large does a have to be in order to guarantee that n really is a prime? (*Hint*) G When testing whether n is prime, by the "brute force" method, as long as n is odd we don't need to divide by even numbers (Why?). This means that you only need to test about half of the numbers up to a-more precisely. we only need to test [a/2] numbers, where [x] means "the next integer larger than r". ([x] is called the ceiling of x.) We can pull the same trick with factors that are divisible by 3. Once we've tested 3 as a factor, we don't need to check 9, 15, 21,... or any other number that is divisible by 3. (Why?) So it seems that this reduces the number of factors that we need to check by about a third, since every third integers are divisible by 3. However, we need to be careful here. We've already ruled out the numbers that are divisible by 2, so the numbers that are divisible by both 2 and 3 have already been ruled out. In other words (using m to denote a positive integer, and using the the notation {} to denote the size of sets): {m ≤a and (2| m or 3 | m)}|= |{m ≤a and 2 | m}| + |{m ≤ a and 3 | m}|-|{m ≤a and 6 | m}|.

Elements Of Modern Algebra
8th Edition
ISBN:9781285463230
Author:Gilbert, Linda, Jimmie
Publisher:Gilbert, Linda, Jimmie
Chapter2: The Integers
Section2.2: Mathematical Induction
Problem 40E: Exercise can be generalized as follows: If and the set has elements, then the number of elements...
icon
Related questions
Question

Please do it to Exercise 9.3.10 and please show step by step and explain

Exercise 9.3.9. To test whether the number n is a prime, you divide n
all the integers 1,2,3,... up to a, and see if any of them divides evenly.
How large does a have to be in order to guarantee that n really is a prime?
(*Hint*)
When testing whether n is prime, by the "brute force" method, as long
as n is odd we don't need to divide by even numbers (Why?). This means
that you only need to test about half of the numbers up to a-more precisely,
we only need to test [a/2] numbers, where [x] means "the next integer
larger than r". ([x] is called the ceiling of x.)
We can pull the same trick with factors that are divisible by 3. Once
we've tested 3 as a factor, we don't need to check 9, 15, 21,... or any other
number that is divisible by 3. (Why?) So it seems that this reduces the
number of factors that we need to check by about a third, since every third
integers are divisible by 3. However, we need to be careful here. We've
already ruled out the numbers that are divisible by 2, so the numbers that
are divisible by both 2 and 3 have already been ruled out. In other words
(using m to denote a positive integer, and using the the notation {...} to
denote the size of sets):
{m ≤a and (2| m or 3 | m)}|=
|{m ≤a and 2 | m}| + |{m ≤ a and 3 | m}|-|{m ≤a and 6 | m}|.
Transcribed Image Text:Exercise 9.3.9. To test whether the number n is a prime, you divide n all the integers 1,2,3,... up to a, and see if any of them divides evenly. How large does a have to be in order to guarantee that n really is a prime? (*Hint*) When testing whether n is prime, by the "brute force" method, as long as n is odd we don't need to divide by even numbers (Why?). This means that you only need to test about half of the numbers up to a-more precisely, we only need to test [a/2] numbers, where [x] means "the next integer larger than r". ([x] is called the ceiling of x.) We can pull the same trick with factors that are divisible by 3. Once we've tested 3 as a factor, we don't need to check 9, 15, 21,... or any other number that is divisible by 3. (Why?) So it seems that this reduces the number of factors that we need to check by about a third, since every third integers are divisible by 3. However, we need to be careful here. We've already ruled out the numbers that are divisible by 2, so the numbers that are divisible by both 2 and 3 have already been ruled out. In other words (using m to denote a positive integer, and using the the notation {...} to denote the size of sets): {m ≤a and (2| m or 3 | m)}|= |{m ≤a and 2 | m}| + |{m ≤ a and 3 | m}|-|{m ≤a and 6 | m}|.
If we are not so careful with the "ceiling function" (which changes the result
by at most 1 anyway), this tells us:
|{ma and 2 | m or 3 | m}| ~ +
a a a
2 3 6
We can turn this around and find the number of integers which are not
divisible by 2 or 3:
a
a a
+
2
3
¹ (1 - ²) (1 - ² )
5.
{m ≤a and 2 m and 3 m}| ~a-
za
This gives the number of trial divisions required to test whether n is prime.
(Of course we also need to test divisibility by 2 and 3, which are 2 additional
divisions.)
The same reasoning can be extended to take into account divisibility by
5, 7, 11, and so on:
Exercise 9.3.10. Using the same reasoning as above, show that after divid-
ing by 2, 3, 5 the number of additional divisions required to test for primality
is approximately:
a (1 - ¹) (¹ - ¹) (¹ - ¹).
The technique of eliminating numbers to check based on previous divis-
ibility is called the sieve of Eratosthenes.
Transcribed Image Text:If we are not so careful with the "ceiling function" (which changes the result by at most 1 anyway), this tells us: |{ma and 2 | m or 3 | m}| ~ + a a a 2 3 6 We can turn this around and find the number of integers which are not divisible by 2 or 3: a a a + 2 3 ¹ (1 - ²) (1 - ² ) 5. {m ≤a and 2 m and 3 m}| ~a- za This gives the number of trial divisions required to test whether n is prime. (Of course we also need to test divisibility by 2 and 3, which are 2 additional divisions.) The same reasoning can be extended to take into account divisibility by 5, 7, 11, and so on: Exercise 9.3.10. Using the same reasoning as above, show that after divid- ing by 2, 3, 5 the number of additional divisions required to test for primality is approximately: a (1 - ¹) (¹ - ¹) (¹ - ¹). The technique of eliminating numbers to check based on previous divis- ibility is called the sieve of Eratosthenes.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Elements Of Modern Algebra
Elements Of Modern Algebra
Algebra
ISBN:
9781285463230
Author:
Gilbert, Linda, Jimmie
Publisher:
Cengage Learning,
Algebra & Trigonometry with Analytic Geometry
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:
9781133382119
Author:
Swokowski
Publisher:
Cengage