#K74437. Taco Sequence Generation
Taco Sequence Generation
Taco Sequence Generation
You are given an integer (N) and are required to generate a sequence of (N) numbers based on the following rules:
1. The first number of the sequence is always (1).
2. For each subsequent element (a_i):
- If (a_i) is even, then (a_{i+1} = \frac{a_i}{2}).
- If (a_i) is odd, then (a_{i+1} = 3a_i + 1).
Note that if (N = 0), the output should be an empty sequence. This problem is inspired by the famous Collatz Conjecture with a twist on the number of iterations.
inputFormat
The input is read from standard input (stdin) and consists of multiple test cases. The first line contains a single integer (T) denoting the number of test cases. Each of the following (T) lines contains a single integer (N), representing the length of the sequence to be generated.
outputFormat
For each test case, output a single line containing the generated sequence of (N) numbers separated by a single space. If (N = 0), output an empty line.## sample
1
1
1
</p>