• + 0 comments

    This is a pretty fun problem.

    We can see that 111...N times mod m = (999.. N times mod 9m) / 9 by mod distributive law

    999.. N times mod 9m can be calculated efficiently with binary exponentiation, it is 10^N - 1, and the 10^N can be calculated in log N time.

    Now when do I get a gf.....