### Dream_Coder10's blog

By Dream_Coder10, history, 4 weeks ago,

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:

https://paste.ubuntu.com/p/s2m5q4JtMs/

• -26

 » 4 weeks ago, # |   0 Auto comment: topic has been updated by Dream_Coder10 (previous revision, new revision, compare).
 » 4 weeks ago, # |   +5 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.
•  » » 4 weeks ago, # ^ |   0 ok..can u tell me about my approach correct or wrong? problem link is given below:https://paste.ubuntu.com/p/vgTZcHQ8Rv/
•  » » » 4 weeks ago, # ^ |   0 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.