Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

The code should be written in Ruby and answers are displayed in the command prompt. Write an application that computes all of the amicable numbers less than the upper bound that is read in using a gets statement. (Use STDIN.gets if you want to be more complete.) The computations will be done in the main method output will be shown by printing directly to the command line with print (or STDOUT.print if you want to be more complete.) The factors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110; 1 + 2 + 4 + 5 + 10 + 11 + 20 + 22 + 55 + 110 = 284. The factors of 284 are 1, 2, 4, 71, 142; 1 + 2 + 4 + 71 + 142 = 220. Therefore, 220 and 284 a pair of amicable numbers. Change the string input read by STDIN.gets into an integer. Do not print any pair of perfect numbers in your output and do not print a pair of amicable numbers more than once. You can satisfy these requirements by only printing the numbers n and sum1 where n == sum2 && n < sum. Use the sum_factors method from the Example that computes the sum of all the factors of the value passed to it.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91426131
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Computer Engineering

The cost of a new piece of equipment is 42000 it is

The cost of a new piece of equipment is $42000. It is expected that the new piece of equipment will lead to cash flows of $17000, $29000, and $40000 over the next three years. Discount rate is 12% what is the net present ...

You are required but not limited to turn in the following

You are required, but not limited, to turn in the following source file: Requirements to get full credits in Documentation The assignment number, your name, StudentID, Lecture number(time), and a class description need t ...

How would the stock market soars and americans wealth

How would the stock market soars and Americans wealth expands significantly affect the econmony, by analyzing in the SRAS-AD diagram and determine the effects on real GDP and the General price level.

Margaret moore wants to invest in four-year bonds that are

Margaret Moore wants to invest in four-year bonds that are currently priced at $863.49. These bonds have a coupon rate of 5.1 percent and make semiannual coupon payments. What is the current market yield on this bond? (R ...

We use typecasting when we want to cast a value of one type

We use typecasting when we want to cast a value of one type to a value of another type. Specifically, in this program, we want to convert a value of type double to a value of type int. Recall that Java lets you assign a ...

You have been offered a contract worth 1 million per year

You have been offered a contract worth 1 million per year for five years. However, to take the contract, you will need to purchase some new equipment. Your discount rate for this project is 12%. You are still negotiating ...

Question a series of information frames with a mean length

Question : A series of information frames with a mean length of 1000 bits is to be transmitted across a data link 4000km long at a data rate of 2Mbps. If the link has a velocity of propagation of 2 *10 8 ms -1 and a BER ...

Fully explain at least one reason why many developing

Fully explain at least one reason why many developing countries suffered serious debt crisis in the early 1980s. Does this reason you explained in debt support Krueger & Srinivasan's argument? Why or why not? How could t ...

Elmers utility function isnbspuxnbspy minxnbspy2 if the

Elmer's utility function is  U ( x ,  y ) = min{ x ,  y 2 }. If the price of  x  is $10 and the price of  y  is $15 and if Elmer chooses to consume 4 units of  y , what must his income be? a. $220 b. $100 c. $320 d. Ther ...

Question you will submit a business case proposal which is

Question: You will submit a Business Case Proposal, which is a summary of your selected business case for the course project. The business case proposal will be submitted as a Word document and in paragraph form. This bu ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As