1

For e.g.

(100 * X) % 35 = 25

gives X = 2

and on similar note

(100 * X) % 360 = 80

gives X = 8

and it can be possible that there is no X which satisfy this

for e.g.

(100 * X) % 360 = 70

there is no X possible in above case

amitchhajer
  • 173
  • 6
  • 2
    Are you familiar with congruences, i.e $, a\equiv b\pmod m\iff m,$ divides $,a-b,,$ and their arithmetic? Do you know Bezout's Identity for the gcd, or Fermat's little Theorem? Please give some background or context so that we can answer at the appropriate level. – Bill Dubuque Mar 15 '14 at 18:04
  • @BillDubuque doesn't look he is familiar with modular arithmetic,otherwise that notation would have been used. Is my answer complete? Anything you'd like to add? – Guy Mar 15 '14 at 18:10
  • @amitchhajer you should have asked AndreNicolas. He answered your question, he would have been happy to provide more details. Anyway, is my answer clear to you? – Guy Mar 15 '14 at 18:10
  • who is AndreNicolas? – amitchhajer Mar 15 '14 at 18:11
  • @amitchhajer my bad. I thought this was your question. Apparently not. http://math.stackexchange.com/questions/713406/how-do-i-calculate-the-number-of-times-angle-x-should-be-added-to-obtain-angle-y – Guy Mar 15 '14 at 18:12
  • same numbers. weird. – Guy Mar 15 '14 at 18:13
  • @amitchhajer Please say a litle about how much number theory you know, e.g. the congruence form of your first equation is $\ 100 x\equiv 60 \pmod{360}.,$ Are you familiar with such congruences and their arithmetic? – Bill Dubuque Mar 15 '14 at 18:14
  • Not really Bill. But I can understand what Sabyasachi has given answer as. Not too good in mathematics. Where should I read more about this? – amitchhajer Mar 15 '14 at 18:18
  • 1
    @amitchhajer Unfortunately the accepted answer is incorrect, and contains various misunderstandings. I don't think that an MSE answer is the best place to attempt to learn congruence arithmetic. Any textbook on elementary number theory will cover this. I recommend browsing the shelves/pages at your local/virtual library to find a textbook that matches your level of knowledge. While you could learn much from prior answers here, but that would be much less efficient than using a good textbook. – Bill Dubuque Mar 15 '14 at 18:41

1 Answers1

1

Using C notation (a*X) % n = b, such a $X$ exists if and only if the GCD (greatest common divisor) of $a$ and $n$ is a divisor of $b$ (of course, assuming $0 \le b < n$). I am afraid that the method to actually find a solution uses more tools than you are familiar with, but at least you can easily check whether a solution exists, and if so you can always do an exhaustive search, which should be fine in your setting. (If you want to know more, a Google search for "linear congruence" yields plenty of references, but you might have to get familiar with congruences first.)

fkraiem
  • 3,129