Цветелина обнови решението на 08.10.2014 23:49 (преди около 11 години)
+START_NUMBERS = { 'lucas' => [2, 1],
+                                'fibonacci' => [1, 1],
+                                'summed' => [3, 2] }
+
+def series(type, index)
+  Hash.new do |hash, index|
+    if index <= 2
+      number = START_NUMBERS[type][index - 1]
+    else
+      number = hash[index - 1] + hash[index - 2]
+    end
+  end[index]
+end
