Nowadays some proofs are generated by computer. In 1976, the four color theorem was the first...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Nowadays some proofs are generated by computer. In 1976, the four color theorem was the first major theorem to be verified using a computer program. In this assignment you will write a computer program to disproof a statement by finding a counterexample. The statement is the following: Every odd number from 3 onwards can be written as the sum of a prime number and twice a square. Some odd numbers (that are greater than or equal to 3) can be written as the sum of a prime number and twice a square. For example, 3=3+2(0²), 5 = 3+2(1²), 7=5+2(1²), 9=7+2(1²), 11=3+2(2²), 13=5+2(2²), 15=7+2(2²), etc. But not all of the odd numbers can be written like that. You need to write a program that would find the smallest counterexample, that is, the smallest odd number (23) that cannot be written as the sum of a prime number and twice a square. (Hint: The smallest counterexample lies between 1000 and 10000.) One way to solve it is the following: generate a list of squares and check odd numbers to see if the number minus twice a square is a prime. You need to do the following: (1) Write a method that takes a natural number n as a parameter and determines if n is a prime number. (2) Generate a list of the first 100 squares (from 0 to 99) and put them in an array of size 100. (100 is enough because 100²-10000 and we know that there is a counterexample between 1000 and 10000.) (3) For every odd number n starting from 3 check whether it can be written as the sum of twice a square and a prime number. To do it, go through the squares in the squares array. For each square, multiply it by 2 and subtract the result from the number n. Use your method from (1) to check whether the difference is a prime number or not. If it is not a prime number then do the same for the next square in the squares array. Otherwise, if the difference is prime, the number n can be written in the desired form so you need to check the next odd number. Continue until you find the smallest counterexample. (4) Output the smallest counterexample which you find. Nowadays some proofs are generated by computer. In 1976, the four color theorem was the first major theorem to be verified using a computer program. In this assignment you will write a computer program to disproof a statement by finding a counterexample. The statement is the following: Every odd number from 3 onwards can be written as the sum of a prime number and twice a square. Some odd numbers (that are greater than or equal to 3) can be written as the sum of a prime number and twice a square. For example, 3=3+2(0²), 5 = 3+2(1²), 7=5+2(1²), 9=7+2(1²), 11=3+2(2²), 13=5+2(2²), 15=7+2(2²), etc. But not all of the odd numbers can be written like that. You need to write a program that would find the smallest counterexample, that is, the smallest odd number (23) that cannot be written as the sum of a prime number and twice a square. (Hint: The smallest counterexample lies between 1000 and 10000.) One way to solve it is the following: generate a list of squares and check odd numbers to see if the number minus twice a square is a prime. You need to do the following: (1) Write a method that takes a natural number n as a parameter and determines if n is a prime number. (2) Generate a list of the first 100 squares (from 0 to 99) and put them in an array of size 100. (100 is enough because 100²-10000 and we know that there is a counterexample between 1000 and 10000.) (3) For every odd number n starting from 3 check whether it can be written as the sum of twice a square and a prime number. To do it, go through the squares in the squares array. For each square, multiply it by 2 and subtract the result from the number n. Use your method from (1) to check whether the difference is a prime number or not. If it is not a prime number then do the same for the next square in the squares array. Otherwise, if the difference is prime, the number n can be written in the desired form so you need to check the next odd number. Continue until you find the smallest counterexample. (4) Output the smallest counterexample which you find.
Expert Answer:
Answer rating: 100% (QA)
1 Project 7 Structure 2 Favorites HN3693927 10 11 12 13 14 o Run HI Four... View the full answer
Related Book For
Accounting Principles Part 3
ISBN: 978-1118306802
6th Canadian edition Volume 1
Authors: Jerry J. Weygandt, Donald E. Kieso, Paul D. Kimmel, Barbara Trenholm, Valerie Kinnear, Joan E. Barlow
Posted Date:
Students also viewed these accounting questions
-
What are some reasons why accounting has adopted "historical" financial statements as the model? What are some disadvantages associated with presenting "historical" financial statements?
-
What are some reasons why a merchandiser might prefer to use a perpetual inventory system over a periodic inventory system?
-
What are some reasons why on-the-job training can prove ineffective? What can be done to ensure its effectiveness?
-
The task in this design project is to design an actuation system to power the ram's reciprocating motion in a small-size shaper. The power source of the actuation system is an AC motor with 0.75 hp...
-
A reaction of the form aA Products is second order with a rate constant of 0.169 L/(mols). If the initial concentration of A is 0.159 mol/L, how many seconds would it take for the concentration of A...
-
The cost of maintaining a certain permanent monument in Washington, DC occurs as periodic outlays of $1000 every year and $5000 every 4 years. Calculate the capitalized cost of the maintenance using...
-
In December 2008, Jason Garcia signed a motor vehicle sales contract with Mac Haik Dodge Chrysler Jeep, a dealer. In the contract, Garcia agreed to purchase a 2009 Dodge Ram 1500. The contract...
-
The Gorman Manufacturing Company must decide whether to manufacture a component part at its Milan, Michigan, plant or purchase the component part from a supplier. The resulting profit is dependent...
-
Find the two unknown sides in this triangle. Keep 4 significant digits. x+3.10m -240m-x 5.21m
-
Complete Tsate's Form 1040-SR, Schedules A, B and D, Form 8949, Form 6252 and Qualified Dividends and Capital Gain Tax Worksheet. Tsate Kongia (birthdate 02/14/1954) is an unmarried high school...
-
Find the average rate of change of f(x) = x 2 + 3x on the intervals indicated. a. From 2 to 4. b. From 3 to 1. c. Is f a linear function? Explain.
-
You have just completed a $24,000 feasibility study for a new coffee shop in some retail space you own. You bought the space two years ago for $96,000, and if you sold it today, you would net...
-
Suppose Rocky Brands has earnings per share of $2.24 and EBITDA of $30.4 million. The firm also has 5.6 million shares outstanding and debt of $140 million (net of cash). You believe Deckers Outdoor...
-
Between 2002 and 2004, when the 1-year interest rate in the euro zone was 120 basis points higher than the U.S. rate, on an average, economists expected a depreciation of the euro based on the...
-
Victoria Enterprises expects earnings before interest and taxes (EBIT) next year of $2.3 million. Its depreciation and capital expenditures will both be $310,000, and it expects its capital...
-
You have $55,000. You put 22% of your money in a stock with an expected return of 15%, $33,000 in a stock with an expected return of 14%, and the rest in a stock with an expected return of 19%. What...
-
The grapevine is: a useless organizational reality the informal vehicle through which messages flow throughout an organization also called upward communication best used for downward vertical...
-
A random sample of 10 houses heated with natural gas in a particular area, is selected, and the amount of gas (in therms) used during the month of January is determined for each house. The resulting...
-
Identify and briefly explain the limitations of financial statement analysis.
-
Explain why trading investments are always reported as current assets and yet investments to earn interest may be reported as current or non-current assets.
-
Solar Power Corporation purchased equipment for $800,000 on September 30, 2013. The equipment was purchased with a $50,000 down payment and the issue of a $750,000, three-year, 4% mortgage note...
-
Given the four criteria necessary for a sale to be complete, which of the following is not one of those conditions? 1. Delivery has occurred or services rendered. 2. Cash has been collected. 3. The...
-
What is the difference between a business and a pure charity? Between a business and a governmental agency?
-
Will reform have a greater impact on insurers or providers?
Study smarter with the SolutionInn App