rubikitch #1105(2007/07/19 13:29 GMT) [ Ruby ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13
def divisors(n) ret = [] 1.upto(n) do |i| ret << i if n % i == 0 end ret end def double_complete_number?(n) n * 3 == divisors(n).inject(0){|s,x| s+x} end 1.upto(10000){|i| puts i if double_complete_number?(i) }
Rating0/0=0.00-0+
[ reply ]
rubikitch
#1105()
[
Ruby
]
Rating0/0=0.00
Rating0/0=0.00-0+
[ reply ]