<pre><script>
var x = 1;
var y = 1;
for(i=1; i<=100; i++) {
document.writeln(i+' : '+(y/x));
var z = x+y;
if(y/x==z/y) break;
else { x = y; y = z; }
}
</script></pre>
40 : 1.618033988749895
<pre><script>
var x = 1.618;
for(i=1; i<=100; i++) {
document.writeln(i+' : '+x);
var y = 1+1/x;
if(x==y) break;
else x = y;
}
</script></pre>
28 : 1.618033988749895
<pre><script>
var x = □;
for(i=1; i<=100; i++) {
document.writeln(i+' : '+x);
var y = (x*x+2)/(2*x);
if(x==y) break;
else x = y;
}
</script></pre>
6 : 1.414213562373095
8 : 1.414213562373095
-