Posts tagged prime

Oct07

Problem 7

comments

prime

Most of the helper methods are just borrowed from Problem 3. What I like about this problem is that even though often blocks in Ruby provide a unique way of solving a problem you can also use more traditional control structures to express an equally elegant solution…..

Continue reading »

Sep21

Problem 3

comments

prime

What I like about this solution is that it consists of just adding a few extensions to the Numeric class plus a simple line that almost repeats the problem given. Ruby does actually include a prime generator through the Prime object in the mathn library. But it seemed to perform worse that even my ultra-naive solution to generating the prime numbers…..

Continue reading »