
Help needed
I am confused on how to solve this??
Let n_{0} be a given positive integer. For i = 0, 1, 2, ... define
if n_{i} is even, then n_{i+1} = n_{i}/2
if n_{i} is odd, then n_{i+1} = 3n_{i} + 1
if n_{i} is 1, the sequence ends
Numbers that are generated this way are called hailstones. Write a program that generates some hailstones. Your program should use the function
void hailstones(int n);
to compute and print the sequence generated by n. The output of your program might look as follows:
Hailstones generated by 77:
77 232 116 58 29 88
44 22 11 34 17 52
26 13 40 20 10 5
16 8 4 2 1
Number of hailstones generated : 23
You might find that all the sequences you generate are finite. Whether this is true in general is still an open question. Hint: Use variables of type long instead of int if the program misbehaves.


Collatz conjecture  Wikipedia, the free encyclopedia
Everything you need to understand the problem is there