Веселин обнови решението на 12.10.2014 12:23 (преди около 10 години)
+def fibonacci number
+ return number if number <= 1
+ fibonacci( number - 1 ) + fibonacci( number - 2 )
+end
+
+def lucas number
+ return 2 if number == 1
+ return 1 if number == 2
+ lucas( number - 1 ) + lucas( number - 2 )
+end
+
+def series function, number
+ case function
+ when "fibonacci" then fibonacci number
+ when "lucas" then lucas number
+ when "summed" then lucas( number ) + fibonacci( number )
+ end
+end