Note that you can only use recursion to solve Q1 and you cannot use any loop. You are free to add helper methods, but you are not allowed to change the method header. Question 1: Crazy series
Note that you can only use recursion to solve Q1 and you cannot use any loop. You are free to add helper methods, but you are not allowed to change the method header.
Question 1: Crazy series
In this session, you need to implement the crazy series method. In the crazy series, you will be given a
starting number. Then, you need to times 2 for each number until the number is greater than 100. After
the number is greater than 100, you need to divide 3 until we reach the number is less than 5. Note that
the input number must be greater than 0, and you are not allowed to use loop here.
For example,
crazySeries(10) should return ArrayList [10.0, 20.0, 40.0, 80.0, 160.0,
53.333333333333336, 17.77777777777778, 5.9259259259259265, 1.9753086419753088]
crazySeries(5) should return ArrayList [5.0, 10.0, 20.0, 40.0, 80.0, 160.0,
53.333333333333336, 17.77777777777778, 5.9259259259259265, 1.9753086419753088]
crazySeries(1) should return ArrayList [1.0, 2.0, 4.0, 8.0, 16.0, 32.0, 64.0, 128.0,
42.666666666666664, 14.222222222222221, 4.7407407407407405]
Step by step
Solved in 4 steps with 4 images