16 lines
334 B
Text
16 lines
334 B
Text
local int = require "int"
|
|
|
|
local perfect = {}
|
|
local n = 1
|
|
while #perfect < 20 do
|
|
local tot = n
|
|
local sum = 0
|
|
while tot != 1 do
|
|
tot = int.totient(tot)
|
|
sum += tot
|
|
end
|
|
if sum == n then perfect:insert(n) end
|
|
n += 2
|
|
end
|
|
print("The first 20 perfect totient numbers are:")
|
|
print(perfect:concat(", "))
|