a=1 s=1 for n=1 to 100

问题描述:

a=1 s=1 for n=1 to 100
set talk off
clear
a=1
s=1
for n=1 to 100
\x05a=2^(n-1)
\x05s=s+a
\x05if s>100000
\x05\x05exit
\x05endif
\x05a=2*a
endfor
set talk on
return

就是等比数列,首相是1,公比是2的前100项之和