Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Show a Java class called CyclicSequence: The solution to this question must NOT use arrays or ArrayLists. The class should output numbers whose sum of

Show a Java class called CyclicSequence:

The solution to this question must NOT use arrays or ArrayLists.

The class should output numbers whose sum of proper divisors form a cyclic sequence that begins and ends with the same number.

Include a method called generateSequence that takes a number as a parameter and outputs the other numbers in the sequence. You can use any number in the list shown below as the starting point to generate the rest of the values in that cyclic sequence.

You can also include a method called sumProperDivisors to calculate the sum of all the number's proper divisors and call it from the generateSequence method.

The output must print the numbers int the sequence (after each value is calculated) separated by 2 spaces.

Use the following to test you logic:

  • The numbers that result in a 2-cycle sequence:  220, 284
  • The numbers result in a 4-cycle sequence: 1547860, 1727636, 1305184, 1264460
  • The numbers result in a 5-cycle sequence: 12496, 14288, 15472, 14536, 14264
  • The only known numbers that result in a 28-cycle sequence are: 14316, 19116, 31704, 47616, 83328,
    177792, 295488, 629072, 589786, 294896, 358336, 418904, 366556, 274924, 275444, 243760, 376736,
    381028, 285778, 152990, 122410, 97946, 48976, 45946, 22976, 22744, 19916, 17716.
  • All other numbers will result in an infinite loop. Your logic will only need to work for the numbers listed above.

 

Example:

Start with  

1547860: the sum of all its proper divisors is 1727636. 

1727636: the sum of all its proper divisors is 1305184

1305184: the sum of all its proper divisors is 1264460

1264460: the sum of all its proper divisors is 1547860

Step by Step Solution

3.36 Rating (159 Votes )

There are 3 Steps involved in it

Step: 1

Heres the Java class called CyclicSequence as per y... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management Accounting Information for Decision-Making and Strategy Execution

Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young

6th Edition

137024975, 978-0137024971

More Books

Students also viewed these Programming questions