Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/chida_fib.rb
Instance Method Summary collapse
Instance Method Details
#closest_fibonacci ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/chida_fib.rb', line 5 def closest_fibonacci n = self x,y = 0,1 n.times do if y > n return x end x,y = y,x+y end end |