Write an application that computes all of the amicable

Assignment Help Basic Computer Science
Reference no: EM13856392

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.

Reference no: EM13856392

Questions Cloud

How will dns be accessed by the lsdg systems : How will systems receive IP addresses. Explain. How will DNS be accessed by the LSDG systems. Explain. Explain how files on the network may be accessed by LSDG.
Challenges for the improvement of the device : Consider that you are a senior consulting engineer and that you need to explain the topic in a written report to your customer, who is the managing director of a large company, and a commerce or law graduate.
What was the original price of the boat : His bank charged 6% per year compounded monthly and his monthly payments were $400. What was the original price of the boat?
Write about is criminal profiling : The topic you will write about is criminal profiling, Each student should select one item or subject of their choice from the forensic materials covered in this week's class materials, including lectures and/or reading assignment, and write a 1200..
Write an application that computes all of the amicable : 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.
Write a javascript program to make change : Write a JavaScript program to make change. You should use prompt() to read a string and parseInt() to convert the string into an integer number of cents (i.e. fractions of a dollar). Your program should write to the document how to deliver that nu..
Analyze the recidivism rates for sex crimes : Analyze the recidivism rates for sex crimes
Explain and clarify items shown on the financial statements : The purpose of footnotes is to explain and clarify items shown on the financial statements. Please list the number and name of each of the footnotes, as well as the page the footnote appears.
Analyze techniques for requirements determination : The specific course learning outcomes associated with this assignment are. Analyze techniques for requirements determination, collection, and organization

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Class structure with its instance fields and methods

What are the advantages of the Java object class structure with its instance fields and methods?

  How would distributed 2pl transaction manager

1 (a)How would distributed 2PL transaction manager and lock manager algorithms change if a distributed computational model was used. 2.(b)Briefly compare and contrast the centralized 2PL and the distributed 2PL in terms of cost to applications

  Implement a sequence recognizer

Implement a sequence recognizer that outputs 1 whenever a sequence of input bits ends in "0010" or "100". This circuit receives (as input) one bit per clock cycle and outputs the value 1 whenever the sequence 0010 or 100 appears

  Feature set of free helix forensics cd

Visit Helix web site and read about feature set of free Helix forensics CD. Note that documentation for Helix is not on CD, to keep it down to ~700MB.

  Write a menu driven program

Write a menu driven program that allows the user to enter five numbers and then choose between finding the smallest , sum or average of the numbers.

  Draw the data flow diagrams level 0

draw the Data Flow Diagrams Level 0 and Level 1 using Microsoft Visio. A visitor may get Registration after filling "Sign Up" form.

  Preparations for construction of a housing development

Riverside Bayview Homes, Inc. (Riverside), owned 80 acres of low-lying marshland (wet-lands) near the shores of Lake St. Clair in Macomb County, Michigan. Riverside began to place fill materials on its property as part of its preparations for constru..

  Use an enhanced for loop to process the array

Write a Java method which takes an integer array parameter and locates the minimum value in the array and outputs that value using System.out.printf. Use an enhanced for loop to process the array. You only need one loop to do this!

  Define artificial intelligence

Provide a reference list of at least 8-sources that are properly cited according to APA format. I would like to see a variety of sources, for example not just articles from one journal.

  Discuss why the user needs are important or stood out

Cite specific examples from readings. Include personal experience with the topic if appropriate

  Find a better predictor for sequence

Find a better predictor for sequence and perform the DPCM again and find the real tag for the sequence.

  Build the erd for the present relationship

Build the ERD for the present relationship

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd