fib_seq
fib_seq
Utilities for generating Fibonacci sequences.
This module provides a function for constructing the Fibonacci sequence up to a specified length using a bottom-up iterative approach, with explicit input validation and clear base case handling.
Functions
| Name | Description |
|---|---|
| fib_seq | >> Generates the Fibonacci sequence from 1 up to a given positive integer n. |
fib_seq
fib_seq.fib_seq(n)Generates the Fibonacci sequence from 1 up to a given positive integer n.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| n | integer | The length of the Fibonacci sequence. | required |
Returns
| Name | Type | Description |
|---|---|---|
| list of int | The Fibonacci sequence of length n. |
Examples
>>> fib_seq(1)
[1]
>>> fib_seq(3)
[1,1,2]