int gcd(int a, int b); An example run of your program is as follows: Enter the number to start searching for k (> 2, inclusive): 1 Enter the number to start searching for k (> 2, inclusive): 2 Enter the number to start searching for k (> 2, inclusive): 3 Enter the number to stop searching for k (inclusive): 2 Enter the number to stop searching for k (inclusive): 1 Enter the number to stop searching for k (inclusive): 20 Enter the number to start searching for a (> 0, inclusive): 0 Enter the number to start searching for a (> 0, inclusive): 1 Enter the number to stop searching for a (inclusive): 10000 Trying k = 3... Trying k = 4... Trying k = 5... Trying k = 6... Trying k = 7... Trying k = 8... Trying k = 9... Trying k = 10... Trying k = 11... Trying k = 12... Trying k = 13... Trying k = 14... Trying k = 15... Trying k = 16... Erdos-Woods number: 16 a = 2184

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
int gcd(int a, int b);
An example run of your program is as follows:
Enter the number to start searching for k (> 2, inclusive): 1
Enter the number to start searching for k (> 2, inclusive): 2
Enter the number to start searching for k (> 2, inclusive): 3
Enter the number to stop searching for k (inclusive): 2
Enter the number to stop searching for k (inclusive): 1
Enter the number to stop searching for k (inclusive): 20
Enter the number to start searching for a (> 0, inclusive): 0
Enter the number to start searching for a (> 0, inclusive): 1
Enter the number to stop searching for a (inclusive): 10000
Trying k = 3...
Trying k = 4...
Trying k = 5...
Trying k = 6...
Trying k = 7...
Trying k = 8...
Trying k = 9...
Trying k = 10...
Trying k = 11...
Trying k = 12...
Trying k = 13...
Trying k = 14...
Trying k = 15...
Trying k = 16...
Erdos-Woods number: 16
a = 2184
Expected
Enter the number to start searching for k (> 2,
inclusive): Enter the number to stop searching for k
(inclusive): Enter the number to start searching for
a (> 0, inclusive): Enter the number to stop
searching for a (inclusive): Trying k
Trying k = 20...
= 19...
Trying k
= 21...
Trying k = 22...
Erdos-Woods number: 22
a = 3521210
Transcribed Image Text:Expected Enter the number to start searching for k (> 2, inclusive): Enter the number to stop searching for k (inclusive): Enter the number to start searching for a (> 0, inclusive): Enter the number to stop searching for a (inclusive): Trying k Trying k = 20... = 19... Trying k = 21... Trying k = 22... Erdos-Woods number: 22 a = 3521210
Part 2– Erdős-Woods Numbers
In this part, you are asked to write a complete C program that finds an Erdős-Woods number.
In number theory, a positive integer k is said to be an Erdős-Woods number if there exists a positive
integer a such that each of the consecutive integers a + i for 0 < i < k shares at least one prime
factor with either a or a + k. In other words, if for a k there is an a such that each evaluation of
ged(a, a + i) > 1 or gcd(a + k,a + i) >1 returns true, then k is an Erdős–Woods number.
For example, one a for k = 16 is 2184. 2184 is 2° x 3 x 7 × 13, while 2184 + 16 = 2200 =
28 x 52 x 11. We can easily verify that all the integers between 2185 and 2199 share at least a prime
factor with either 2184 or 2200.
Your C program should begin by prompting the user to enter four integers:
- The number to start searching for k. It needs to be greater than 2. Your program will start
searching for Erdős-Woods number from this starting point (inclusive).
- The number to stop searching for k (inclusive). It needs to be greater than the starting point
above searching for k.
- The number to start searching for a (inclusive). It needs to be positive (greater than 0).
- The number to stop searching for a (inclusive). It needs to be greater than the starting point
above searching for a.
When the stated requirements for these integers are not satisfied (for example, the starting point
searching for k is not greater than 2), the user will be repeatedly prompted to enter new values for
the same integer until the requirements are satisfied.
Once valid values for these four integers have been entered, your program should start from the
starting point of searching for k, and use the definition of Erdős–Woods number to see if k is an
Erdős-Woods number. To save some computation time, your program only needs to search in the
range specified by the user for a.
Your C program needs to define and use at least one function that computes the greatest common
divisor between two integers, a and b:
Transcribed Image Text:Part 2– Erdős-Woods Numbers In this part, you are asked to write a complete C program that finds an Erdős-Woods number. In number theory, a positive integer k is said to be an Erdős-Woods number if there exists a positive integer a such that each of the consecutive integers a + i for 0 < i < k shares at least one prime factor with either a or a + k. In other words, if for a k there is an a such that each evaluation of ged(a, a + i) > 1 or gcd(a + k,a + i) >1 returns true, then k is an Erdős–Woods number. For example, one a for k = 16 is 2184. 2184 is 2° x 3 x 7 × 13, while 2184 + 16 = 2200 = 28 x 52 x 11. We can easily verify that all the integers between 2185 and 2199 share at least a prime factor with either 2184 or 2200. Your C program should begin by prompting the user to enter four integers: - The number to start searching for k. It needs to be greater than 2. Your program will start searching for Erdős-Woods number from this starting point (inclusive). - The number to stop searching for k (inclusive). It needs to be greater than the starting point above searching for k. - The number to start searching for a (inclusive). It needs to be positive (greater than 0). - The number to stop searching for a (inclusive). It needs to be greater than the starting point above searching for a. When the stated requirements for these integers are not satisfied (for example, the starting point searching for k is not greater than 2), the user will be repeatedly prompted to enter new values for the same integer until the requirements are satisfied. Once valid values for these four integers have been entered, your program should start from the starting point of searching for k, and use the definition of Erdős–Woods number to see if k is an Erdős-Woods number. To save some computation time, your program only needs to search in the range specified by the user for a. Your C program needs to define and use at least one function that computes the greatest common divisor between two integers, a and b:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY