In the paper "Fibonacci Series Modulo m" by D.D. Wall (found here), there is a table in the Appendix listing values for the function $k(p)$. This function is defined as the period of the Fibonacci numbers mod p before any repeats occur. For instance, k(7) = 16 since
\begin{align} F(p) \mod 7 = \{0, 1, 1, 2, 3, 5, 1, 6, 0, 6, 6, 5, 4, 2, 6, 1\} \end{align}
where $F(p)$ is the $p^{th}$ Fibonacci number. Hence, the values in the sequence above are cyclic after 16 terms. My question is again in regard to the table at the end that lists various values for the function $k(p)$.
The first few terms check out fine, however, for some values for instance 113 or 181, the values of $k(p)$ do not appear to be correct. To check the values, I wrote a quick script in Python that you're more than welcome to use.
phi = (1+5**0.5)/2
def F(n):
return int(round((phi_pos**n - (1-phi_pos)**n) / 5**0.5))
def FModM(n,m):
return F(n) % m
def k(p, nums):
run = 0
for i in range(1, len(nums)):
if nums[i] == 0 and nums[i+1] == 1 and nums[i+2] == 1 and nums[i+3] == 2:
run = i
break
print p,":",run
nums = []
max = 200
m = 101
for i in range(max):
nums.append(FModM(i,m))
k(m,nums)
Both values 113 and 181 for instance return 0 since even after generating 200 terms (what max is defined to be in the program) no cycle has shown itself.
I'm not sure if the values are actually incorrect in the table, or if my understanding is not 100% on the matter. Any feedback would be very much appreciated. Thanks again.