With these exercises, you will build upon the design and implementation of leastFactor (see the Method Design - leastFactor.pdf).
- If you have not done so already, use the leastFactor design to implement and test this method.
- 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.
- 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.