作业帮 > 数学 > 作业

VB程序设计:在3阶Fibonacci数列的前100项中找出所有素数.要求用下面两种方法分别实现:

来源:学生作业帮 编辑:拍题作业网作业帮 分类:数学作业 时间:2024/05/23 02:08:40
VB程序设计:在3阶Fibonacci数列的前100项中找出所有素数.要求用下面两种方法分别实现:

数组在求素数过程中动态增长

使用数组列表

所谓3阶Fibonacci数列:1,1,1,3,5,9,17,31,57


a=1
b=1
c=1
for i=4 to 100
d=a+b+c
for j=2 to d
if(i mod j=0) then
break;
end if
next
if jd then
print i &" is sushu"
end if
a=b
b=c
c=d
next
纯手打,
再问: 大神~求用数组的方法做一下,麻烦了
再答: a=1 b=1 c=1 t=0 sushu[100] for i=4 to 100 d=a+b+c for j=2 to d if(i mod j=0) then break; end if next if jd then sushu[t]=i t=t+1 end if a=b b=c c=d next for i=0 to t printf sushu[i] & "is sushu!!!" next