Skip to content

Commit

Permalink
Updated Integer#is_fibonacci?
Browse files Browse the repository at this point in the history
  • Loading branch information
skalnik committed Oct 4, 2008
1 parent c9518cf commit 314ea6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/euler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def is_pandigital?(x)
# 4.is_fibonacci? # => true
def is_fibonacci?
a, b = Math.sqrt((5*(self**2))+4), Math.sqrt((5*(self**2))-4)
return true if a.to_i == a or b.to_i == b
return true if (a.to_i == a and b.to_i != b) or (a.to_i != a && b.to_i == b)
return false
end

Expand Down

0 comments on commit 314ea6d

Please sign in to comment.