## Can this script have better performance using modular exponentiation?

问题 def f(a, b, c): return ((a ** b)-1) // c % b Can this script be faster in some way? (I have been looking for something with modular exponentiation): pow(a, b, c) == a ** b % c but this above script doesn't seem to be improvable like that. Does anyone know a way to speedup the above script? Thanks in advance. Edit: The second script is not at all the same as the first one, it is just meant to show what kind of optimization I had in mind. Edit: I didn't put the exact equation in becouse I