#K506. Taco Sequence Generation
Taco Sequence Generation
Taco Sequence Generation
You are given an integer N and your task is to generate a sequence S of length N defined as follows:
\(S_0 = 0,\; S_1 = 1\), and for all \(i \geq 2\):
\(S_i = S_{i-1} + S_{i-2} + i\)
For example:
- If N = 1, the sequence is: [0]
- If N = 3, the sequence is: [0, 1, 3]
- If N = 5, the sequence is: [0, 1, 3, 7, 14]
Your program should read the input from standard input (stdin) and output the sequence numbers separated by a space to standard output (stdout).
inputFormat
The input consists of a single integer N (N ≥ 1
), representing the number of elements in the sequence to generate.
outputFormat
Output the generated sequence with each number separated by a single space.
## sample1
0
</p>