Created
October 13, 2011 11:42
-
-
Save miura1729/1284034 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PHI = (Math.sqrt(5.0) + 1) / 2 | |
def rfib(a) | |
l5 = Math.log(Math.sqrt(5.0)) | |
la = Math.log(a - (1 / Math.sqrt(5.0))) | |
lp = Math.log(PHI) | |
(la + l5) / lp | |
end | |
(1..10000).each do |i| | |
# p "#{i} #{rfib(i)}" | |
if rfib(i).to_i != rfib(i + 1).to_i then | |
print "#{i} " | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment