Sha256: 1373d33b7ec24b1e985eec41c5a8df50b2c3d7eb6ddad204063f6db8f407be67
Contents?: true
Size: 392 Bytes
Versions: 2
Compression:
Stored size: 392 Bytes
Contents
#!/usr/bin/env ruby module fibonacci def closest_fibonacci def fibonaccit(n) return n if (0..1).include? n fibonaccit(n-1) + fibonaccit(n-2) if n > 1 end i = 0 while fibonaccit(i) < self do i = i + 1; end fib(i - 1) end end class Float; include fibonacci; end class Fixnum; include fibonacci; end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
closest_fibonacci-1.2.6 | bin/closest_fibonacci |
closest_fibonacci-1.2.5 | bin/closest_fibonacci |