Permalink
Browse files

added exercise 1.13

  • Loading branch information...
1 parent 8a971d7 commit e0f15eb05a6a9c5418cae877bafac77938c05cd4 @cosmin committed Feb 1, 2010
Showing with 19 additions and 0 deletions.
  1. +19 −0 exercise-1-13.txt
View
19 exercise-1-13.txt
@@ -0,0 +1,19 @@
+Fib(1) = 1
+Fib(2) = 1
+SQ5 = sqrt(5)
+
+Fib(1) = ((1+ SQ5 - 1 + SQ5)/2) / SQ5
+ = SQ5 / SQ5
+ = 1
+
+Fib(2) = ((1 + 2*SQ5 + 5)/4 - (1 - 2*SQ5 + 5)/4) / SQ5
+ = ((1/4 + SQ5/2 + 5/4) - (1/4 - SQ5/2 + 5/4)) / SQ5
+ = (1/4 - 1/4 + 5/4 - 5/4 + SQ5) / SQ5
+ = 1
+
+Fib(n) = Fib(n-1) + Fib(n-2)
+ = (q^n-1 - v^n-1) / SQ5 + (q^n-2 - v^n-2) / SQ5
+ = ((q^n-1 + q^n-2) - (v^n-1 - v^n-2)) / SQ5
+ = (q^n - v^n) / SQ5
+
+Fib(n) = q^n/SQ5 - v^n/SQ5 AND v^n/SQ5 < 0.5 therefore q^n/SQ5 is closest int to Fib(n)

0 comments on commit e0f15eb

Please sign in to comment.