Ясен обнови решението на 14.10.2013 01:54 (преди около 12 години)
+#!/usr/local/bin/ruby -w
+
+class Integer
+  def prime?
+    self < 2 ? false : (2...self).all? { |d| self % d != 0 }
+  end
+
+  def prime_factors
+    res = (2..abs).to_a.select { |x| x.prime? }
+	res.map { |x| [x] * abs.downto(0).min_by { |y| abs % x**y } }.flatten
+  end
+
+  def harmonic
+    (1..self).to_a.map { |a| 1 / a.to_r}.reduce(:+)
+  end
+
+  def digits
+    abs.to_s.chars.map(&:to_i)
+  end
+end
+
+class Array
+  def frequencies
+    Hash[map { |x| [x, select { |y| y == x }.size] }]
+  end
+
+  def average
+    reduce(:+) / size.to_f
+  end
+
+  def combine_with(other)
+    (take(s = other.size).zip(other) << drop(s) << other.drop(size)).flatten
+  end
+
+  def drop_every(n)
+    each_with_index.select { |el, id| el if id % n != n-1 }.map { |x| x[0] }
+  end
+end
