Excuse my incorrect use of terminology, I hope my question is clear:
I am coding a Python module which tests whether a given number is a member of the Fibonacci series. No problem with that. Additionally, should a number not be a member of the series, I would like to test whether it is significantly close to its nearest Fibonacci neighbor. Here an increasing deviation margin of what is considered "close" is needed, along the lines of:
deviation margin (x) increases as given number (n) increases
For my purposes 9 is significantly close to Fibonacci number 8 but 10 is not. 1600 is significantly close to Fibonacci number 1597 but 1610 is not, etc. So, the test for "significant closeness" is applying a deviation margin of 1 at lower numbers and an increasing deviation margin as the series increments up to infinity.
I figured a logical candidate for inclusion in the test would be Standard Deviation. So I have calculated a coarse margin as follows:
margin = (StdDev / ( n + closestfibneighbor)) * StdDev
This does not give me good control over the margin rate of increase and I am sure there is a more appropriate function to express the growth in margin caused by increments in x. Please feel free to elaborate on the mathematics of this - I am seeking a general solution and not a Python-specific function.