21 lines
470 B
Text
21 lines
470 B
Text
limite = 1000000-1
|
|
'Maximum array size is 1,000,001 elements
|
|
dim DSum(limite+1)
|
|
dim DCount(limite+1)
|
|
|
|
for i = 0 to limite
|
|
DSum(i) = 1
|
|
DCount(i) = 1
|
|
next i
|
|
|
|
for i = 2 to limite
|
|
j = i + i
|
|
while j <= limite
|
|
if DSum(j) = j then
|
|
print using("########", j); " equals the sum of its first"; using("###", DCount(j)); " divisors"
|
|
end if
|
|
DSum(j) = DSum(j) + i
|
|
DCount(j) = DCount(j) + 1
|
|
j = j + i
|
|
wend
|
|
next i
|