Sha256: 7381f5e5fda30245bbd24f70deef5e98b840d73ae09a5923eb678e8ed441ae03
Contents?: true
Size: 356 Bytes
Versions: 396
Compression:
Stored size: 356 Bytes
Contents
local function aliquot_sum(n) local sum = 0 for i = 1, n - 1 do if n % i == 0 then sum = sum + i end end return sum end local function classify(n) local sum = aliquot_sum(n) if sum < n then return 'deficient' end if sum > n then return 'abundant' end return 'perfect' end return { aliquot_sum = aliquot_sum, classify = classify }
Version data entries
396 entries across 396 versions & 1 rubygems