F (mod 2) = {{1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0}, {1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0}}
Here 0 is repeating at every 3rd index and the cycle repeats at every 3rd index.
F (mod 3) = {{1, 1, 2, 0, 2, 2, 1, 0, 1, 1, 2, 0, 2, 2, 1, 0}, {1, 1, 2, 0, 2, 2, 1, 0, 1, 1, 2, 0, 2, 2}}
Here 0 is repeating at every 4th index and the cycle repeats at every 8th index.
F (mod 4) = {{1,1,2,3,1,0,1,1,2,3,1,0,1,1,2,3},{1,0,1,1,2,3,1,0,1,1,2,3,1,0}}
Here 0 is repeating at every 6th index and the cycle repeats at every 6th index.
F (mod 5) = {{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,4,0}}
Here 0 is repeating at every 5th index and the cycle repeats at every 20th index.
F (mod 6) = {{1,1,2,3,5,2,1,3,4,1,5,0,5,5,4}, {3,1,4,5,3,2,5,1,0,1,1,2,3,5,2}}
Here 0 is repeating at every 12th index and the cycle repeats at every 24th index.
F (mod 7) = {{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 }}
Here 0 is repeating at every 8th index and the cycle repeats at every 16th index.
The time complexity of this function is O(n), where n is the nth multiple of k we are looking for.
The auxiliary space used by this function is O(n).