F(n)^xmod n code example
Example: how to calculate pisano period
long long get_pisano_period(long long m) {
long long a = 0, b = 1, c = a + b;
for (int i = 0; i < m * m; i++) {
c = (a + b) % m;
a = b;
b = c;
if (a == 0 && b == 1) return i + 1;
}
}