Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 20 lines (15 sloc) 0.531 kb
e0f15eb @cosmin added exercise 1.13
authored
1 Fib(1) = 1
2 Fib(2) = 1
3 SQ5 = sqrt(5)
4
5 Fib(1) = ((1+ SQ5 - 1 + SQ5)/2) / SQ5
6 = SQ5 / SQ5
7 = 1
8
9 Fib(2) = ((1 + 2*SQ5 + 5)/4 - (1 - 2*SQ5 + 5)/4) / SQ5
10 = ((1/4 + SQ5/2 + 5/4) - (1/4 - SQ5/2 + 5/4)) / SQ5
11 = (1/4 - 1/4 + 5/4 - 5/4 + SQ5) / SQ5
12 = 1
13
14 Fib(n) = Fib(n-1) + Fib(n-2)
15 = (q^n-1 - v^n-1) / SQ5 + (q^n-2 - v^n-2) / SQ5
16 = ((q^n-1 + q^n-2) - (v^n-1 - v^n-2)) / SQ5
17 = (q^n - v^n) / SQ5
18
19 Fib(n) = q^n/SQ5 - v^n/SQ5 AND v^n/SQ5 < 0.5 therefore q^n/SQ5 is closest int to Fib(n)
Something went wrong with that request. Please try again.