Closed FrankKair closed 6 years ago
The smallest divisible number by a range from 1 to 20, is the lcm of the accumulated number.
lcm
(1..19).reduce { |acc, x| acc.lcm(x) }
Go
Real time: 0.541 s User time: 0.145 s Sys. time: 0.184 s CPU share: 60.84 %
How the solution works
The smallest divisible number by a range from 1 to 20, is the
lcm
of the accumulated number.(1..19).reduce { |acc, x| acc.lcm(x) }
Performance
Go