func is_arithmetic(n) { n.tau `divides` n.sigma } say "The first one hundred arithmetic numbers:" 100.by(is_arithmetic).each_slice(10, {|*a| a.map { '%3s' % _ }.join(' ').say }) for x in (1e3, 1e4, 1e5, 1e6) { var arr = x.by(is_arithmetic) say "\n#{x}th arithmetic number is #{arr.last}." say "There are #{arr.count{.is_composite}} composite arithmetic numbers <= #{arr.last}." }