for n=1,500 do s=1 i=1 while s>0 do i=i+1 s=n%i>0 and s-1 or s+i-1 end i=i