Perfect numbers: Difference between revisions

(→‎{{header|Fortran}}: adding GAP (almost built-in))
Line 437:
end</lang>
=={{header|Lua}}==
<lang Lua>function IsPerfectisPerfect( x )
local sum = 0
for i = 1, x-1 do
ifsum = (x % i) == 0 thenand sum + i or sum
sum = sum + i
end
end
return sum == sum + ix
if sum == x then
return true
else
return false
end
end</lang>
 
Anonymous user