I found the following problem here.
f(x, n) = x21 + x22 + x23 + ... + x2n
Example: f(2, 10) mod 1000000007 = 180974681
Calculate mod 1000000007.
We know that abc mod p = mod p.
The period of the sequence 2n mod 1000000006 is φ(1000000006) = 500000002.
The period is too large to calculate the sum. Help please?