Skip to content

Instantly share code, notes, and snippets.

@miura1729
Created October 13, 2011 11:42
Show Gist options
  • Save miura1729/1284034 to your computer and use it in GitHub Desktop.
Save miura1729/1284034 to your computer and use it in GitHub Desktop.
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