4 ms·
Related, and slightly more interesting than the linked article (I think), is you can get similar 'almost equal to an integer'-results by using recursive relatio
by meuk 9y ago
Related, and slightly more interesting than the linked article (I think), is you can get similar 'almost equal to an integer'-results by using recursive relations.
Take, for example, a Fibonacci-like sequence, defined by f(k + 2) = f(k) + f(k + 1) and f(0) = 2, f(1) = 1. Then you get the solution f(n) = a^n + b^n, where a = (1 - sqrt(5))/2 and b = (1 + sqrt(5))/2. So |a| < 1 and |b| > 1. If the recursive relation has integer coefficients, then a^n + b^n will be an integer. For large n, |a^n| will get very small, so b^n will be very close to an integer.
For example ((1 + sqrt(5)) / 2) ^ 20 = 15126.9999
It should be possible to find a recursive relation where |a| is smaller, so that b^n is closer to an integer, but hey, I'm supposed to be working now.
Edit: Coincidentally, this result is also presented in the math stackexchange post that soVeryTired linked to (actually, this is not a coincidence, since this is the most basic recursive relation, and has easily memorable forms for a and b).