Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### Survivor's blog

By Survivor, history, 16 months ago, , Hi Everyone!
I am trying to solving this codechef problem.
I am stuck in the theoretical mathematics part of it.
The editorial explains some equations which i am unable to understand.
Can somebody please explain me how these equations are formed and worked along and where does this algebraic representation of pascal triangle given in the editorial come from?
Any help is appreciated.
Thanks. By Survivor, history, 3 years ago, , link to spoj problem "blamoeba" i need help to complete this problem. i am stuck since last 2 days. solution was easy but i am not getting how to use modular inverse to calculate the final answer. answer — y/x = (m-1)*(m^n)/(m^n-1) (where m^n means m to the power n). how to calculate the gcd of numerator and denominator before using modulo ?
according to me the answer should be

x = (m^n-1)/gcd
y = (m-1)*(m^n)/gcd

help me to do this or correct me if i am doing something wrong 