I am trying to find long periodic orbits for the logistic map $f(x) = a*x(1-x)$ [i.e. which parameter values cause the map to have long periodic orbits]. My task is to change the parameter and find the longest possible orbit I can find by using computational means.
I have a program which first iterates the map $10^9$ times for a user-input parameter value and a random $x$ value in the range $(0,1)$ and then looks for period $2^N$ orbits starting with $N = 1$ and increasing. It does this by looking at the last iterate and comparing it to the iterate $2^N$ before. If it is within a tolerance amount (say $10^{-10}$) then the program outputs "we have a period, $2^N$, orbit" and terminates.
My issue is that when I think I've found a long orbit say $2^{10}$, and I print out the value $2^4$ before the last, it looks really close and may possibly be a $2^4$ orbit instead. How do I determine what the tolerance should be for determining an orbit? Is there a better way to do this?