Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
6
Task/Fibonacci-sequence/C-sharp/fibonacci-sequence-7.cs
Normal file
6
Task/Fibonacci-sequence/C-sharp/fibonacci-sequence-7.cs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
static double r5 = Math.Sqrt(5.0), Phi = (r5 + 1.0) / 2.0;
|
||||
|
||||
static ulong fib(uint n) {
|
||||
if (n > 71) throw new ArgumentOutOfRangeException("n", n, "Needs to be smaller than 72.");
|
||||
double r = Math.Pow(Phi, n) / r5;
|
||||
return (ulong)(n < 64 ? Math.Round(r) : Math.Floor(r)); }
|
||||
Loading…
Add table
Add a link
Reference in a new issue