Skip to content

Instantly share code, notes, and snippets.

@hyuki0000
Created March 22, 2017 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyuki0000/2e33150caa99195330a817fb07d98472 to your computer and use it in GitHub Desktop.
Save hyuki0000/2e33150caa99195330a817fb07d98472 to your computer and use it in GitHub Desktop.
\phi^n looks like an integer. cf. https://twitter.com/hyuki/status/844562998349877248
Phi = (Math.sqrt(5) + 1) / 2
30.times do |n|
r = Phi ** n
puts r - r.to_i
end
@hyuki0000
Copy link
Author

0.0
0.6180339887498949
0.6180339887498949
0.2360679774997898
0.8541019662496856
0.09016994374947629
0.9442719099991628
0.03444185374863906
0.9787137637478054
0.013155617496451555
0.9918693812442569
0.005024998740708497
0.9968943799850081
0.0019193787256881478
0.9988137587107531
0.0007331374365548982
0.9995468961474216
0.00028003358420392033
0.9998269297320803
0.0001069633162842365
0.9999338930483646
4.085636464878917e-05
0.9999747494148323
1.5605786757078022e-05
0.9999903552088654
5.960988346487284e-06
0.9999963162117638
2.2772583179175854e-06
0.9999985934700817
8.707866072654724e-07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment