You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pclass="subtleHeading">Problem written by Moussa Doumbouya</p>
39
+
<hr/>
40
+
<p>
41
+
When two numbers a and b are such that their ratio (a/b) is the same as the ratio
42
+
of their sum to the largest of the two numbers (a+b)/a, they are said to be in the <ahref="https://en.wikipedia.org/wiki/Golden_ratio">golden ratio.</a>
43
+
<br/><br/>
44
+
The golden ratio is then: ϕ = (a+b) / a = a / b.
45
+
<br/><br/>
46
+
The Fibonacci sequence is the sequence is such that the first two elements are 1,
47
+
and any other element is the sum of the two elements preceeding it.
48
+
<ul>
49
+
<li>F(0) = 1</li>
50
+
<li>F(1) = 1</li>
51
+
<li>F(2) = F(1) + F(0) = 2</li>
52
+
<li>F(3) = F(2) + F(1) = 3</li>
53
+
<li>F(4) = F(3) + F(2) = 5</li>
54
+
<li>F(5) = F(4) + F(3) = 8</li>
55
+
<li>F(6) = F(5) + F(4) = 13</li>
56
+
<li>F(7) = F(6) + F(5) = 21</li>
57
+
<li>...</li>
58
+
<li>F(n) = F(n-1) + F(n-2)</li>
59
+
60
+
</ul>
61
+
62
+
The ratio of consecutive Fibonaccy terms 1/1, 2/1, 3/2, 5/3, 8/5, 13/8, 21/13, etc. for larger and larger terms converges towards
63
+
one number, ... the golden ratio!
64
+
</p>
65
+
66
+
<p>
67
+
Write a program that estimates the golden ratio as the ratio of consecutive Fibonaccy terms.
68
+
Here is a possible top-down decomposition.
69
+
70
+
<ul>
71
+
<li>A function that displays the golden ratio at position i (in Fibonacci sequence) for i going from 1 to 100</li>
72
+
<li>A function that computes the golden ratio at position i, F(i) / F(i-1)</li>
73
+
<li>A function that computes the Fibonaccy term i, F(i)</li>
74
+
</ul>
75
+
</p>
76
+
77
+
<p>
78
+
Here is a sample of the expected output of your program:
0 commit comments