News for hackers. Stuff that matters.
Re:Proof You Can Become a Better Programmer by CydeWeys on Sunday November 27, 2016 @11:13AM (#13049849)
I've never used Ruby before, but I learned something interesting when Googling what I thought was a weakness in his preferred solution to the first problem: Apparently, in Ruby, integer types have two internal representations that are flexibly switched between as needed. One representation uses a fixed size (analogous to long/int64 in other languages) and the other representation, Bignum, has an arbitrary size (analogous to Java's BigDecimal). So the simple (1..n).reduce(:lcm) approach should work for n of arbitrary size, though I don't think it's the most efficient approach.

There are no comments on this comment yet.