Георги обнови решението на 15.10.2014 12:21 (преди около 10 години)
+def n_member(first, second, n)
+ (n - 1).times do
+ second, first = first + second, second
+ end
+
+ first
+end
+
+def fibonacci(n)
+ n_member 1, 1, n
+end
+
+def lucas(n)
+ n_member 2, 1, n
+end
+
+def series(sequence, n)
+ case sequence
+ when 'fibonacci' then fibonacci n
+ when 'lucas' then lucas n
+ when 'summed' then (fibonacci n) + (lucas n)
+ end
+end