Ad Infinitum Maths HackerRank problem

Revision en4, by marcose18, 2015-07-06 13:05:18

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.

Tags gaussian elimination, hackerrank

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English marcose18 2015-07-06 13:05:18 1008
en3 English marcose18 2015-07-06 12:47:40 18
en2 English marcose18 2015-07-06 12:46:59 33
en1 English marcose18 2015-07-06 12:45:21 288 Initial revision (published)