#C13990. Fibonacci Sequence Generator
Fibonacci Sequence Generator
Fibonacci Sequence Generator
Given a single integer n, generate the first n numbers of the Fibonacci sequence. The Fibonacci sequence is defined by the recurrence relation \(F_0 = 0\), \(F_1 = 1\), and \(F_n = F_{n-1} + F_{n-2}\) for \(n \ge 2\). If \(n < 1\), then the output is an empty list.
The output must be printed in a Python list format. For example, if n = 5
, the expected output is:
[0, 1, 1, 2, 3]
Please read the input from the standard input (stdin) and print the result to the standard output (stdout).
inputFormat
The input consists of a single integer n provided via standard input.
Example:
5
outputFormat
Output the first n Fibonacci numbers formatted as a Python list. If n < 1, output an empty list []
.
Example Output for n = 5
:
[0, 1, 1, 2, 3]## sample
0
[]