1樓:匿名使用者
private sub command1_click()dim s as string
for i = 1 to 6
s = s & fab(i) & " "
next
text1 = s
end sub
function fab(byval n as integer) as long
if n = 1 or n = 2 thenfab = 1
elseif n >= 3 then
fab = fab(n - 1) + fab(n - 2)end if
end function
2樓:獨孤求上清
用函式來做:
dim fab(6) as integerfunction fablach(x as integer, y as integer) as long
dim z as integr
z=x+y
reture z
end function
後面的就是:
fab(n)=fablach(fab(n-1),fab(n-2))
斐波拉契數列問題
f n 1 5 下面用特徵值法求f n 裴波那契數列 1 1 2 3 5 的通項 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 ...
vb第N項計算出來當然數列,vb求裴波那契數列的第n項
private sub command1 click if option1.value true thentext1.text f 30 end if if option2.value true thentext1.text f 33 end if if option3.value true the...
裴波那契數列是怎樣的數列?有什麼特別的地方
靠名真tm難起 一 斐波那契數列指的是這樣一個數列 1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368.這個數列從第3項開始,每一項都等於前兩項之和。二 斐波那契數列中的...