Problem statement: Given n and equation n*x % (x-n) = 0. How many solution. Thank in advance, and sorry for my poor English.
Problem statement: Given n and equation n*x % (x-n) = 0. How many solution. Thank in advance, and sorry for my poor English.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 4 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 134 |
| 9 | maroonrk | 133 |
| 10 | qwexd | 130 |
| Name |
|---|



This solution is wrong the reason is stated in the replies.
I'm not 100% sure about my solution but here you go.
since n*x%(x — n) = 0 then nx — m(x — n) = 0.
nx — mx + mn = 0
moving things around we get
nx = mx — mn => mx — mn = nx turning this into a congruence
equation
we choose x as the mod
we get mx = mn (mod x) => mn = 0 (mod x)
since we know the constant is n then mn — nx = 0
by solving for m we get m = x
by substituting in the first equation we get
nx — x(x — n) = 0
nx — xx + xn = 0
2nx — xx = 0
by solving for n we get n = x/2.
If there is anything wrong please note it out
we always have more than 1 answer, for example n = 6, x = 3 and n = 6, x = 4. The number of dividers of the number n is similar to the number of answers, but this is not true
Yes you are right I think the problem is in this line:
we get mx = mn (mod x) => mn = 0 (mod x)
since we know the constant is n then mn — nx = 0
I considered the constant to remain n but since one of the two numbers changed then this is wrong.
Just use that n*x % (x-n) = n*(x-n + n) % (x-n) = (n*(x-n) + n^2) % (x-n) = n^2 % (x-n).
So the number of solutions is just the numbers of divisors of n2.
thank you