#C10287. Sequence Generation: Arithmetic or Geometric Progression
Sequence Generation: Arithmetic or Geometric Progression
Sequence Generation: Arithmetic or Geometric Progression
You are given a positive integer ( n ). Your task is to generate a sequence of ( n ) integers based on the following rules:
- If ( n = 1 ), the sequence is simply [1].
- If ( n ) is even, generate a geometric progression starting with 1 and a common ratio of 2. That is, the sequence is defined as ( a_1 = 1 ) and ( a_{i+1} = 2 \times a_i ) for ( 1 \le i < n ).
- If ( n ) is odd and greater than 1, generate an arithmetic progression starting with 1 and a common difference of 2. That is, the sequence is defined as ( a_1 = 1 ) and ( a_{i+1} = a_i + 2 ) for ( 1 \le i < n ).
Output the sequence as space-separated integers.
inputFormat
A single line containing a positive integer ( n ) where ( 1 \le n \le 10^5 ).
outputFormat
A single line containing ( n ) space-separated integers representing the generated sequence.## sample
1
1
</p>