### marcose18's blog

By marcose18, history, 6 years ago,

Greetings Codeforces : - I was stuck on this Problem and it's editorial is also not clear enough. You can find its Editorial here.I wanted to ask one question that if we have modular equations like in this problem and if the mod is prime then is it true that they will be equal.I mean in this task C(i) = sum of its C(j)'s % mod and since mod is prime number does that mean they have to be equal(C(i) = sum of its C(j)'s).Of course for composite numbers it will definiately not hold because one simple case to fail it will be to consider a factor of mod and if n = mod/factor + 2 then it easily fails as 1 will be friend with all others and all others having 1 as his friend & and all of them having equal candies.Of course there will be only few n to fail this depending on the factors mod has but afterall there are cases.So if there is such a property for prime numbers I would like to know it (not taking into account case of 1).And yeah also please give some hints on how to solve this problem using Gaussian Elimination or any other method you like suitable.Thanks in advance.

• 0

 » 6 years ago, # |   0 Auto comment: topic has been updated by marcose18 (previous revision, new revision, compare).
 » 6 years ago, # |   0 Auto comment: topic has been updated by marcose18 (previous revision, new revision, compare).
 » 6 years ago, # | ← Rev. 2 →   0 i did this problem just by counting pairs which are of form a=b and b=a and then taking 99991 to the power k where k are the number of pairs , u can also solve this by finding the rank of matrix .