class Fixnum
Public Instance Methods
fibo?()
click to toggle source
# File lib/mani_zanec_math/fixnum/fibo.rb, line 2 def fibo? arr = [0,1] while self > arr.last x, y = arr.pop(2) arr.push(x, y, x + y) end return true if self == arr.last return false end
prime?()
click to toggle source
# File lib/mani_zanec_math/fixnum/prime.rb, line 2 def prime? return true if self == 1 2.upto(self) do |num| if self % num == 0 return self == num end end end