local int = require "int" require "rat" local one = rat.of(1) print("The following numbers (less than 2^19) are perfect:") for i = 2, (1 << 19) - 1 do local sum = rat.of(1, i) local divs = int.divisors(i, true) divs:remove(1) for divs as j do sum += rat.of(1, j) end if sum == one then print($" {i}") end end