why moduler multiplicative inverse is not working under modulo 1000000007 by fermats littile theorem ? let n=11 & k=3 ; n/k should be equal to 3. but its giving me 666666675. same thing goes for n=10 & k=4;
problem:
https://paste.ubuntu.com/p/vgTZcHQ8Rv/
my code:
Modular multiplicative inverse of $$$3$$$ under modulo $$$(10^9 + 7)$$$ is $$$333333336$$$ because $$$3 * 333333336 = 1 (mod (10^9 + 7))$$$
$$$11 * 333333336 = 666666675 (mod (10^9 + 7))$$$
It is correct.
ok..can u tell me about my approach correct or wrong?
problem link is given below:
https://paste.ubuntu.com/p/vgTZcHQ8Rv/
You are giving the problem in a very weird format.
I don't see how inverses can be used here. You should evenly divide the stick and use just (fast) modular exponentiation.