Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can basically make your own kind of 'near misses' with recurrent relations. If you have a recurrent relation of the type f(n + 1) = a * f(n) + b * f(n - 1), you (almost always) get a solution of the form f(n) = c * alpha^n + d * beta^n, where alpha and beta depend only on a and b (specifically, they are the root of the characteristic polynomial, see [1]), and c and d can be determined by the seed values of f. By choosing integers a and b such that the absolute value of beta is less than one (but not zero), you will have that c * alpha^n approximates f(n), since d * beta^n will tend to zero for large n. At the same time f(n) will produce integer values, since we picked integers for a and b.

[1] https://en.wikipedia.org/wiki/Recurrence_relation#Roots_of_t...



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: