Thursday, 15 August 2013

prime number test in Ruby

prime number test in Ruby

I have an array a = [1,2,3,4,5]. I want to test which of the numbers are
prime and wanted to produce the output {1=>false, 2=>true, 3=>true,
4=>false, 5=>true}.
Any one liner will be appreciated.

No comments:

Post a Comment