pocketlang/test/benchmark/factors/factors.rb

10 lines
156 B
Ruby
Raw Normal View History

2021-05-24 06:17:52 +08:00
start = Time.now
N = 50000000; factors = []
for i in 1...N+1
if N % i == 0
factors.append(i)
end
end
puts "elapsed: " + (Time.now - start).to_s + ' s'