local i, j, sum sum = 0 for i = 1, 10000, 1 do j = 1 sum = 0 while j<=i/2 do if(i%j==0) then sum=sum+j; end end if(sum==i) then print(i) end end