| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Exercise - Factors  Prime Numbers

Page history last edited by Steve Sweeney 14 years, 1 month ago

With these exercises, you will build upon the design and implementation of leastFactor (see the Method Design - leastFactor.pdf).

 

  1. If you have not done so already, use the leastFactor design to implement and test this method.
  2. Design and write a method that uses leastFactor to find and output all of the prime factors of the user input.  For example, given an input of 12, your method should output the numbers 2, 2, and 3.  Design your solution as a group and implement individually.
  3. Design and write a method that finds the Nth prime number, where N is specified by the user.  The first prime number is 2, the second prime number is 3, and so on.  You must use leastFactor as part of this solution.  If you wish to check your answers, a lists of prime numbers can be found online (here is a list of the first 500 prime numbers).  Your method should be able to provide the 1000th prime number.  Design in groups and implement individually.

Comments (0)

You don't have permission to comment on this page.