Consider a List of integer places that is not empty and is referred to as inList. In accordance
with the following line of reasoning, determine and output outList:
Using the following principles, construct a sequence of numbers for each element in inarr,
beginning with the one that is immediately to the left of the current element:
In the series, the current element is the number that comes first in the sequence.
Using the current number as a starting point, the following formula is used to generate the next
number in the sequence:
o Divide the current number by two to determine the next number in the sequence, provided that
the current number is even.
o For the next number in the sequence, if odd, multiply the current number by three and then add
one. This will give you the next number in the sequence.
o Continue performing the processes outlined above until the number is produced.
Using C program, determine how many numbers are contained in each sequence that has been
constructed. Next, add the appropriate identified counts to outList in the order that the elements
appear in inList.
Sample Input
Sample Output
Explanation:
Input:
For : Sequence Total count
For : Sequence
Total count
Therefore, outList