1,1,2,3,5,8,13,21.第N項是幾多?公式?N項加起上來是幾多?
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/23 10:02:43
1,1,2,3,5,8,13,21.第N項是幾多?公式?N項加起上來是幾多?
1,1,2,3,5,8,13,21.第N項是幾多?公式?N項加起上來是幾多?
1,1,2,3,5,8,13,21.第N項是幾多?公式?N項加起上來是幾多?
裴波那契数列:1,1,2,3,5,8,13,.裴波那契数列递推公式:F(n+2) = F(n+1) + F(n) F(1)=F(2)=1.它的通项求解如下:F(n+2) = F(n+1) + F(n) => F(n+2) - F(n+1) - F(n) = 0 令F(n+2) - aF(n+1) = b(F(n+1) - aF(n)) 展开F(n+2) - (a+b)F(n+1) + abF(n) = 0 显然a+b=1 ab=-1 由韦达定理知 a、b为二次方程 x^2 - x - 1 = 0 的两个根 解得a = (1 + √5)/2,b = (1 -√5)/2 或 a = (1 -√5)/2,b = (1 + √5)/2 令G(n) = F(n+1) - aF(n),则G(n+1) = bG(n),且G(1) = F(2) - aF(1) = 1 - a = b,因此G(n)为等比数列,G(n) = b^n ,即 F(n+1) - aF(n) = G(n) = b^n --------(1) 在(1)式中分别将上述 a b的两组解代入,由于对称性不妨设x = (1 + √5)/2,y = (1 -√5)/2,得到:F(n+1) - xF(n) = y^n F(n+1) - yF(n) = x^n 以上两式相减得:(x-y)F(n) = x^n - y^n F(n) = (x^n - y^n)/(x-y) = {[(1+√5)/2]^n-[(1-√5)/2]^n}/√5
斐波那契数列 它的通项公式为:(1/√5)*{[(1+√5)/2]^n - [(1-√5)/2]^n}【√5表示根号5】 用编程语句为: 【C语言程序】 main() { long fib[40] = {1,1}; int i; for(i=2;i<40;i++) { fib[i ] = fib[i-1]+fib[i-2]; } for(i=0;i<40;i++) { printf("F%d==%d\n", i, fib); } return 0; }