Yes, all a consequence of how Phi is defined (of course). The continued fraction for Phi is 1,1,1,1,1, ..., meaning if you punch this into your calculator:
(start with any number, say 1)
+
1 =
1/x
+
1 =
1/x
+
1 =
1/x ...
it eventually converges to Phi, because you're computing that continued fraction.
If you do it with different constants, you get different numbers. For example, 1,2,2,2,2, ... gives sqrt(2) (or, repeating 2 gives sqrt(2)-1).
There are a few peculiar (namely, transcendental) numbers with interesting forms as continued fractions, such as
formatting link
Continued fractions are amazing for computing approximations. Two practical examples:
Suppose you need a transformer of a particular ratio, but you're limited on turns count (say, because it's a high frequency transformer and self-capacitance or electrical length is critical). You can take the desired ratio, subtract the integer part, and take the reciprocal of the remainder. Repeat until you get a conveniently small remainder.
Example: 300 to 50 ohm balun. You need +/-75 ohms to 50, or a turns ratio of 1:1.2247.. per side. So we compute...
1 (remainder 0.2247...)
4 (remainder 0.449...)
2 (remainder 0.2247...)
4 (remainder 0.449...) (also, note any pattern?)
If we take the first, it's 1:1, which is terrible. The second is 1 + 1/4, which is high, but pretty close (1.25). The third is 1/2 of a 1/4 closer (1.222..), and the fourth is 1/4 of the way closer still (1.225). So you see it tends to converge, and sometimes it converges quite quickly. If you get a big integer at some point (more than 5 or so), that's how you know it's a good stopping point.
Example two: arbitrary-frequency PWM. Suppose you have an 8 bit register but you want 16 bit control. Well, obviously, you're screwed, you can never be guaranteed to get better than 8 bits of counting out of it, right? But... that doesn't mean the resolution always has to be in steps of 1/256th. In fact, it can be quite a bit better.
What you do is, first, start with the desired ratio. It is expressed in some form that's more numerically accurate than what we're doing: it could be a fractional word of more bits than the register (e.g., 0.16 fixed point), or floating point (not that you'd be wasting your resources handling floats..), or some arbitrary rational ratio (in P/Q numerator and denominator form*).
*Note that the fixed point fraction is implicitly a fraction in terms of Q = 2^N. Floating point numbers are similarly limited, though in a much less simplified way (because the exponent is variable; on the upside, most exponents -- that are too large (>= 1), or that give a number much smaller than 1/256th -- simply don't matter because we won't be able to express them, anyway).
Note also that, if Q < 256, we're home free, because we can enter that mark-space ratio into the registers directly. See where this is going?
What you do is, after inputting the ratio num!, (yes, this is BASIC -- I wrote it *years* ago!)
CONST MAXVAL = 256
a = FIX(num!) pm1 = 1: qm1 = 0: p0 = a: q0 = 1 FOR i = 1 TO 100 num! = num! - a IF num! < 1 / MAXVAL THEN EXIT FOR num! = 1 / num! a = FIX(num!) p1 = a * p0 + pm1 q1 = a * q0 + qm1 IF p1 > MAXVAL OR q1 > MAXVAL THEN EXIT FOR pm1 = p0: qm1 = q0: p0 = p1: q0 = q1 NEXT
Returns p0, q0 = best convergent for q0 < MAXVAL.
So, if num! = ratio to output via PWM, then assign p0 => cycles_output_positive and q0 => total_cycles_of_register. Guaranteed q0