Chat with us, powered by LiveChat

Create a Java class called Cyclic Sequence

JAVA

Create a Java class called Cyclic Sequence

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 generate Sequence 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 to calculate the sum of all the number’s proper divisors and call it from the generate Sequance method.

The output must list all numbers of the sequence 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