如果一个正整数的所有因子之和等于其本身,则此数称为完“数”。根据欧几里德完数定理,
若2^(n+1)-1是一个质数,那么2^n(2^(n+1)-1)必是一个完数。本程序采用该定理求1~1000之间的完数,在适当划线处填入适当的内容。
private sub command1_click()
dim n as integer ,q as integer
dim a as double ,m as double
dim i as integer ,t as integer
n=1  
do while a<1000
a=2^n*(2^(n+1)-1)
m=2^(n+1)-1
i=2
q=int(m/2)
t=1
do while i<=q and t=1
if m mod i<>0 then
______________________
else 
t=0
endif
loop
if ______________________then print a,
n=n+1
loop
end sub