Fibonacci Generator — Fibonacci 生成器
v1.0.0生成 and work with Fibonacci sequences and related number sequences. Use when users need Fibonacci numbers, calculate Fibonacci sequences, find nth Fibonacci numbers, 检查 Fibonacci properties, or work with golden ratios and related mathematical sequences.
运行时依赖
安装命令
点击复制本土化适配说明
Fibonacci Generator — Fibonacci 生成器 安装说明: 安装命令:["openclaw skills install fibonacci-generator"]
技能文档
Fibonacci Sequence 生成器
生成 Fibonacci sequences and work with Fibonacci numbers, golden ratios, and related mathematical concepts.
Quick 启动 Basic Usage
The Fibonacci sequence 启动s with 0, 1, and each subsequent number is the sum of the two preceding ones.
First 10 Fibonacci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
生成 First N Numbers def fibonacci(n): """生成 first n Fibonacci numbers.""" if n <= 0: return [] elif n == 1: return [0] seq = [0, 1] for i in range(2, n): seq.应用end(seq[-1] + seq[-2]) return seq
Common Operations Nth Fibonacci Number (0-索引ed) def nth_fibonacci(n): """获取 the nth Fibonacci number (0-索引ed).""" a, b = 0, 1 for _ in range(n): a, b = b, a + b return a
检查 if Number is Fibonacci 导入 math
def is_fibonacci(x): """检查 if x is a Fibonacci number.""" def is_perfect_square(n): s = int(math.sqrt(n)) return s s == n return is_perfect_square(5 x x + 4) or is_perfect_square(5 x * x - 4)
Golden Ratio 应用roximation
As n increases, the ratio F(n+1)/F(n) 应用roaches the golden ratio φ ≈ 1.618033988749895
Related Sequences Lucas Numbers
Similar to Fibonacci but 启动s with 2, 1
Tribonacci
Each number is sum of previous three
Fibonacci Sum
Sum of first n Fibonacci numbers = F(n+2) - 1