From: "Jan E." Date: 2012-07-08T10:20:11+09:00 Subject: Re: Find that number is repeated more and less times in an array Hi, I don't understand what you're saying. OK, you have a given number n. Are you looking for all elements that occur *at least* n times in the array? To count the number of occurences, you can use Enumerable#inject: array = [1, 2, 2, 3, 2, 5] element = 2 element_count = array.inject 0 do |count, x| count + (x == element ? 1 : 0) end Or a more lowlevel solution: array = [1, 2, 2, 3, 2, 5] element = 2 element_count = 0 array.each do |x| element_count += 1 if x == element end -- Posted via http://www.ruby-forum.com/.