Write a program to calculate and count the quantity of prime numbers between a given range....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to calculate and count the quantity of prime numbers between a given range. Prime numbers and Cryptography: The story of the quest for an unbreakable asymmetric cipher was solved by three MIT computer scientists in 1977: Ron Rivest, Adi Shamir, and Leonard Adelman. This team developed a one-way modular function (known as RSA encryption) that is beyond the scope of this course, but the general principle is not difficult. Imagine Alice picks two prime numbers, p and q, and calculates their product, such that N = px q. Assume that she chose p = 17,159 and q = 10,247, giving N a value of 175,828,273. N is now Alice's public encryption key that she distributes to anyone who wants it. Bob looks up Alice's public key (N=175,828,273) and uses it in the RSA one-way function, which is also public. Bob uses the one-way function specific to Alice's public key, encrypts the message, and sends it to her. The RSA one-way function turns out to be reversible if p and q are known. Since Alice is the only one who knows the two secret prime numbers, she is the only one who can decrypt the message. Are you skeptical at this point? If everybody knows N and the one-way formula, surely Eve or anyone else can deduce p and ql The trick, of course, is to pick large prime numbers, say on the order of 1065, which is 1 followed by 65 zeroes! Is that big enough for you? The product of two such prime numbers would be 10130 and it would take a standard desktop computer roughly 50 years to factor a prime number that big. On the other hand, a hundred million personal computers working in tandem could factor a number as big as 10130 in approximately... 15 seconds. Since paranoia prevails among cryptographers, important transactions like banking business tend to use values of N that are at least 10308. It is estimated that 100 million personal computers working in parallel would take more than a thousand years to crack a value of N that large. That should convince you that if you mind (the values of) your ps and qs, RSA is impregnable. Note: Numeric examples are excerpted from Simon Singh's, Code Book. The Program: 1. The design and implementation details of this program are completely up to you. Use object-oriented programming style. Make use of the this keyword when defining your implementation class. 2. The program should allow the user to enter a lower and an upper limit (e.g., 1 to 100 or 25 to 500). 3. All prime numbers within the lower and upper limits should be calculated. 4. Output needs to clearly communicate to the user what they are seeing. Neatly display all prime numbers within the given range. Also, provide a count of how many prime numbers were found. 5. Include documentation throughout the program to communicate each section's purpose. Components Comments include name, date, and purpose of program. OOP style used. Class or classes well structured. Program sections meaningfully documented. Variables and/or constants correctly used (use this keyword). Methods correctly written. User prompted to input lower and upper limits of prime numbers. Output neatly displayed. The quantity of prime numbers generated is accurate and displayed. No compiler or runtime errors. Thoughtful PMR included. Total 09.08 Thinking Outside the Box Grading Rubric 1 2 2 1 2 4 2 2 2 1 1 20 Points Possible Points Earned Write a program to calculate and count the quantity of prime numbers between a given range. Prime numbers and Cryptography: The story of the quest for an unbreakable asymmetric cipher was solved by three MIT computer scientists in 1977: Ron Rivest, Adi Shamir, and Leonard Adelman. This team developed a one-way modular function (known as RSA encryption) that is beyond the scope of this course, but the general principle is not difficult. Imagine Alice picks two prime numbers, p and q, and calculates their product, such that N = px q. Assume that she chose p = 17,159 and q = 10,247, giving N a value of 175,828,273. N is now Alice's public encryption key that she distributes to anyone who wants it. Bob looks up Alice's public key (N=175,828,273) and uses it in the RSA one-way function, which is also public. Bob uses the one-way function specific to Alice's public key, encrypts the message, and sends it to her. The RSA one-way function turns out to be reversible if p and q are known. Since Alice is the only one who knows the two secret prime numbers, she is the only one who can decrypt the message. Are you skeptical at this point? If everybody knows N and the one-way formula, surely Eve or anyone else can deduce p and ql The trick, of course, is to pick large prime numbers, say on the order of 1065, which is 1 followed by 65 zeroes! Is that big enough for you? The product of two such prime numbers would be 10130 and it would take a standard desktop computer roughly 50 years to factor a prime number that big. On the other hand, a hundred million personal computers working in tandem could factor a number as big as 10130 in approximately... 15 seconds. Since paranoia prevails among cryptographers, important transactions like banking business tend to use values of N that are at least 10308. It is estimated that 100 million personal computers working in parallel would take more than a thousand years to crack a value of N that large. That should convince you that if you mind (the values of) your ps and qs, RSA is impregnable. Note: Numeric examples are excerpted from Simon Singh's, Code Book. The Program: 1. The design and implementation details of this program are completely up to you. Use object-oriented programming style. Make use of the this keyword when defining your implementation class. 2. The program should allow the user to enter a lower and an upper limit (e.g., 1 to 100 or 25 to 500). 3. All prime numbers within the lower and upper limits should be calculated. 4. Output needs to clearly communicate to the user what they are seeing. Neatly display all prime numbers within the given range. Also, provide a count of how many prime numbers were found. 5. Include documentation throughout the program to communicate each section's purpose. Components Comments include name, date, and purpose of program. OOP style used. Class or classes well structured. Program sections meaningfully documented. Variables and/or constants correctly used (use this keyword). Methods correctly written. User prompted to input lower and upper limits of prime numbers. Output neatly displayed. The quantity of prime numbers generated is accurate and displayed. No compiler or runtime errors. Thoughtful PMR included. Total 09.08 Thinking Outside the Box Grading Rubric 1 2 2 1 2 4 2 2 2 1 1 20 Points Possible Points Earned
Expert Answer:
Answer rating: 100% (QA)
Python program with added comments and documentation python class PrimeNumberGenerator def initself ... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
Ria works at a Quickie Carwash. That morning she was reluctant to go into work because her young son had complained of feeling hot and dizzy and she was concerned that he might be getting sick, but...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Dakota Corporation prepared, for 2014 and 2013, the following balance sheet data: 2014 2013 Cash $87,375 63,750 Available-for-sale securities (not cash equivalents) 17,250 105,000 Accounts...
-
The Fisher Apparel Company balance sheet for the year ended 2006 is as follows: a. What is Fisher's investment in current assets? b. Determine Fisher's working capital investment. c. Determine...
-
Publicly traded companies release financial statements (unaudited) on a quarterly basis. For the quarter ended December 31, 2009, Market Watch reported that Bank of America (B of A) and Wells Fargo...
-
Innovation is a key asset for any organization. Let us assume you agree with this statement and decide to bring innovation into your organization. If yours is a typical company it may fit the...
-
The Anchor Glass Container Corporation and its parent company, Consumers Packaging, Inc. (CPI), entered into a series of agreements with Encore Glass, Inc., to supply glass containers of a specific...
-
Adria Lopez created Success Systems on October 1, 2013. The company has been successful, and Adria plans to expand her business. She believes that an additional $ 86,000 is needed and is...
-
what are the benefits of the relational model relationships and ERD ( entity-relationship model)?
-
The following information, taken from the books of Herman Brothers Manufacturing represents the operations for January: The job cost system is used, and the February cost sheet for Job M45 shows the...
-
A pie is removed from your oven with an internal temperature of 170F. It is placed on your counter to cool. The temperature of the room is 60F. If the temperature is 140F after half an hour, how much...
-
1. Describe the evidence rule with the most significant impact on the outcome of criminal matters. 2. Provide examples of federal statutes in contract law. 3. Explain and describe the concept of...
-
According to the text, what helps to explain why only male students have committed "rampage school shootings," and what helps to explain why these killing have occurred only at rural and suburban,...
-
Explain the difference between co-payment and co-insurance. Describe what a deductible is and how it's used?
-
Task : Email to Kara At Hamilton Now Realty, Kara has received a complaint. The complaint is about failing to disclose the true condition of a property and has been referred to the CAC. Kara is...
-
Put the following case name information and reporter information or public domain information in correct Bluebook citation form. Do not put a period at the conclusion of the "citation" you draft if a...
-
Pre-laboratory Assignment 4, Intravenous Sugar Solutions, Making Basic Solutions. Name Kristin O'Neill (i) - Normal saline solutions are used to clean wounds, help remove contact lenses and by...
-
Using Gauss-Jordan elimination, invert this matrix ONLY 0 0 0 0 1
-
Rewrite Exercise 20.17 using JSF, as shown in Figure 33.35. The program lets the user enter four card values and finds a solution upon clicking the Find a Solution button. This exercise is a...
-
Listing 6.7, PrimeNumberMethod.java, provides the isPrime(int number) method for testing whether a number is prime. Use this method to find the number of prime numbers less than 10000. Listing 1...
-
Rewrite Programming Exercise 18.9 using a helper method to pass the substring high index to the method. The helper method header is: public static void reverseDisplay(String value, int high) Write a...
-
Why is it said that the PSNR principle has both a right and a duty side? Which one is most relevant with respect to international environmental law?
-
How many dimensions of the PSNR principle can you enumerate? To which one does UN Resolution 1803(1962) refer?
-
If there is a separate principle of precaution, do we need a principle of prevention?
Study smarter with the SolutionInn App