Suppose I have a fibonacci sequence
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584
Now if I have a modulo 5 fibonacci sequence,it will look like
0 1 1 2 3 0 3 3 1 4 0 4 4 3 2 0 2 2 4 1 0 1 1 2 3 0 3 3 1
If I have modulo 7 fibonacci sequence it will look like
0 1 1 2 3 5 1 6 0 6 6 5 4 2 6 1 0 1 1 2 3 5 1 6 0 6 6 5 4 2 6
Now,we notice that the pattern repeats in the modular fibonacci sequence. I want to know what is the point at which the pattern starts repeating.I mean what is the relationship of the repetiton-start-position with the modular number like 5,7,11,etc.
Please keep it as simple as possible.I have to use this concept in an algorithm
EDIT On some research I found this as the answer,but it involves lot of maths which I cannot understand.Can someone please decode it and give me a direct expression