What is modulo arithmetic

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
4
down vote

favorite
1












I'm trying to understand what mod means in this equation and how to solve it:



d * 13 = 1 mod 1680


This is from how to make a public and private key pair. The answer is 517 apparently and I can get that from wolfram. I assume mod is %, but that doesn't seem to work out. I've also seen that this could me mod( 1, 1680 ) which supposedly equals



mod( m, n ) = m - n ( m / n )


But for that I get 1 and then 1 / 13 is obviously not 517. Just looking for some direction. Thanks.



Ha, I know so little that I can't even find a tag to add.







share|cite|improve this question


















  • 2




    Compare Math use and programming use.
    – Jyrki Lahtonen
    Nov 9 '11 at 14:22














up vote
4
down vote

favorite
1












I'm trying to understand what mod means in this equation and how to solve it:



d * 13 = 1 mod 1680


This is from how to make a public and private key pair. The answer is 517 apparently and I can get that from wolfram. I assume mod is %, but that doesn't seem to work out. I've also seen that this could me mod( 1, 1680 ) which supposedly equals



mod( m, n ) = m - n ( m / n )


But for that I get 1 and then 1 / 13 is obviously not 517. Just looking for some direction. Thanks.



Ha, I know so little that I can't even find a tag to add.







share|cite|improve this question


















  • 2




    Compare Math use and programming use.
    – Jyrki Lahtonen
    Nov 9 '11 at 14:22












up vote
4
down vote

favorite
1









up vote
4
down vote

favorite
1






1





I'm trying to understand what mod means in this equation and how to solve it:



d * 13 = 1 mod 1680


This is from how to make a public and private key pair. The answer is 517 apparently and I can get that from wolfram. I assume mod is %, but that doesn't seem to work out. I've also seen that this could me mod( 1, 1680 ) which supposedly equals



mod( m, n ) = m - n ( m / n )


But for that I get 1 and then 1 / 13 is obviously not 517. Just looking for some direction. Thanks.



Ha, I know so little that I can't even find a tag to add.







share|cite|improve this question














I'm trying to understand what mod means in this equation and how to solve it:



d * 13 = 1 mod 1680


This is from how to make a public and private key pair. The answer is 517 apparently and I can get that from wolfram. I assume mod is %, but that doesn't seem to work out. I've also seen that this could me mod( 1, 1680 ) which supposedly equals



mod( m, n ) = m - n ( m / n )


But for that I get 1 and then 1 / 13 is obviously not 517. Just looking for some direction. Thanks.



Ha, I know so little that I can't even find a tag to add.









share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 9 '11 at 23:49









J. M. is not a mathematician

59.8k5146283




59.8k5146283










asked Nov 9 '11 at 13:53









Brian

1211




1211







  • 2




    Compare Math use and programming use.
    – Jyrki Lahtonen
    Nov 9 '11 at 14:22












  • 2




    Compare Math use and programming use.
    – Jyrki Lahtonen
    Nov 9 '11 at 14:22







2




2




Compare Math use and programming use.
– Jyrki Lahtonen
Nov 9 '11 at 14:22




Compare Math use and programming use.
– Jyrki Lahtonen
Nov 9 '11 at 14:22










5 Answers
5






active

oldest

votes

















up vote
2
down vote













$aequiv b pmod c$ means that



$a-b=kcdot c$ for some integer $k$ so:



$13d equiv 1 pmod 1680$ means that:



$13d-1=kcdot 1680$ for some integer $k$



Edit:



Maple code :



enter image description here






share|cite|improve this answer





























    up vote
    2
    down vote













    Well, we learnt in childhood that 53 divided by 7 leaves a remainder 4. In modular arithmetic. we write that as $53equiv4 mod 7$. Given $nequiv k mod j$, we interpret it as $j$ divides $(n-k)$ or $j|(n-k)$.Here is a link. I hope that helps.






    share|cite|improve this answer





























      up vote
      0
      down vote













      To same that $a= b,operatornamemod n$ is to say that when you divide $a$ and $b$ by $n$ you end up with the same remainder. So, $517cdot 13=6721$. Divide $6721$ by $1680$ and you get a remainder of $1$.






      share|cite|improve this answer




















      • I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
        – Brian
        Nov 9 '11 at 14:13










      • It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
        – Joe Johnson 126
        Nov 9 '11 at 14:40










      • This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
        – Joe Johnson 126
        Nov 9 '11 at 14:40










      • From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
        – Brian
        Nov 9 '11 at 17:03

















      up vote
      0
      down vote













      I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,



      5 % 4 = 1


      This implies that $$5 equiv 1 qquad (textmod 4)$$
      (It is not the same, however. See Michael Hardy's comments below.)



      However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:



      (note to anyone scanning, the following is intentionally incorrect)



      13 * d = 1 mod 1680 = 1 % 1680 = 1


      and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.



      The original equation asks,



      $$13 dequiv 1 qquad (operatornamemod 1680)$$



      or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.



      There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:



      d=1
      while (d * 13 % 1680 != 1):
      d++


      On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):



      If we are looking for $d$ such that $13dequiv 1 quad (operatornamemod 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:



      $$13d-1680k=1$$



      This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.



      Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.






      share|cite|improve this answer


















      • 1




        5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
        – Michael Hardy
        Nov 9 '11 at 19:26







      • 1




        Ah, I said the same, and I should have said implies.
        – process91
        Nov 9 '11 at 19:45


















      up vote
      0
      down vote













      $pmod 1680$ means you consider all integers that differ by a multiple of $1680$ to be equivalent. They form a ring, which means (like the integers) you can add, subtract, multiply, and maybe divide. If the modulus is prime, you have a field and can divide as well. In this case you can divide and $13*517=6721=4*1680+1$, so $13^-1=517.$ You will be able to do any division where the values are coprime to $1680$ (do not share any factors, which are $2,3,5,7$).






      share|cite|improve this answer






















        Your Answer




        StackExchange.ifUsing("editor", function ()
        return StackExchange.using("mathjaxEditing", function ()
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        );
        );
        , "mathjax-editing");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "69"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        convertImagesToLinks: true,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        noCode: true, onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );








         

        draft saved


        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f80529%2fwhat-is-modulo-arithmetic%23new-answer', 'question_page');

        );

        Post as a guest






























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        2
        down vote













        $aequiv b pmod c$ means that



        $a-b=kcdot c$ for some integer $k$ so:



        $13d equiv 1 pmod 1680$ means that:



        $13d-1=kcdot 1680$ for some integer $k$



        Edit:



        Maple code :



        enter image description here






        share|cite|improve this answer


























          up vote
          2
          down vote













          $aequiv b pmod c$ means that



          $a-b=kcdot c$ for some integer $k$ so:



          $13d equiv 1 pmod 1680$ means that:



          $13d-1=kcdot 1680$ for some integer $k$



          Edit:



          Maple code :



          enter image description here






          share|cite|improve this answer
























            up vote
            2
            down vote










            up vote
            2
            down vote









            $aequiv b pmod c$ means that



            $a-b=kcdot c$ for some integer $k$ so:



            $13d equiv 1 pmod 1680$ means that:



            $13d-1=kcdot 1680$ for some integer $k$



            Edit:



            Maple code :



            enter image description here






            share|cite|improve this answer














            $aequiv b pmod c$ means that



            $a-b=kcdot c$ for some integer $k$ so:



            $13d equiv 1 pmod 1680$ means that:



            $13d-1=kcdot 1680$ for some integer $k$



            Edit:



            Maple code :



            enter image description here







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited Nov 9 '11 at 14:36

























            answered Nov 9 '11 at 14:11









            Peđa Terzić

            8,03622268




            8,03622268




















                up vote
                2
                down vote













                Well, we learnt in childhood that 53 divided by 7 leaves a remainder 4. In modular arithmetic. we write that as $53equiv4 mod 7$. Given $nequiv k mod j$, we interpret it as $j$ divides $(n-k)$ or $j|(n-k)$.Here is a link. I hope that helps.






                share|cite|improve this answer


























                  up vote
                  2
                  down vote













                  Well, we learnt in childhood that 53 divided by 7 leaves a remainder 4. In modular arithmetic. we write that as $53equiv4 mod 7$. Given $nequiv k mod j$, we interpret it as $j$ divides $(n-k)$ or $j|(n-k)$.Here is a link. I hope that helps.






                  share|cite|improve this answer
























                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    Well, we learnt in childhood that 53 divided by 7 leaves a remainder 4. In modular arithmetic. we write that as $53equiv4 mod 7$. Given $nequiv k mod j$, we interpret it as $j$ divides $(n-k)$ or $j|(n-k)$.Here is a link. I hope that helps.






                    share|cite|improve this answer














                    Well, we learnt in childhood that 53 divided by 7 leaves a remainder 4. In modular arithmetic. we write that as $53equiv4 mod 7$. Given $nequiv k mod j$, we interpret it as $j$ divides $(n-k)$ or $j|(n-k)$.Here is a link. I hope that helps.







                    share|cite|improve this answer














                    share|cite|improve this answer



                    share|cite|improve this answer








                    edited Nov 9 '11 at 19:23









                    Michael Hardy

                    205k23187463




                    205k23187463










                    answered Nov 9 '11 at 14:47









                    Eisen

                    1,20031527




                    1,20031527




















                        up vote
                        0
                        down vote













                        To same that $a= b,operatornamemod n$ is to say that when you divide $a$ and $b$ by $n$ you end up with the same remainder. So, $517cdot 13=6721$. Divide $6721$ by $1680$ and you get a remainder of $1$.






                        share|cite|improve this answer




















                        • I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                          – Brian
                          Nov 9 '11 at 14:13










                        • It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                          – Brian
                          Nov 9 '11 at 17:03














                        up vote
                        0
                        down vote













                        To same that $a= b,operatornamemod n$ is to say that when you divide $a$ and $b$ by $n$ you end up with the same remainder. So, $517cdot 13=6721$. Divide $6721$ by $1680$ and you get a remainder of $1$.






                        share|cite|improve this answer




















                        • I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                          – Brian
                          Nov 9 '11 at 14:13










                        • It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                          – Brian
                          Nov 9 '11 at 17:03












                        up vote
                        0
                        down vote










                        up vote
                        0
                        down vote









                        To same that $a= b,operatornamemod n$ is to say that when you divide $a$ and $b$ by $n$ you end up with the same remainder. So, $517cdot 13=6721$. Divide $6721$ by $1680$ and you get a remainder of $1$.






                        share|cite|improve this answer












                        To same that $a= b,operatornamemod n$ is to say that when you divide $a$ and $b$ by $n$ you end up with the same remainder. So, $517cdot 13=6721$. Divide $6721$ by $1680$ and you get a remainder of $1$.







                        share|cite|improve this answer












                        share|cite|improve this answer



                        share|cite|improve this answer










                        answered Nov 9 '11 at 14:07









                        Joe Johnson 126

                        13.6k32567




                        13.6k32567











                        • I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                          – Brian
                          Nov 9 '11 at 14:13










                        • It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                          – Brian
                          Nov 9 '11 at 17:03
















                        • I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                          – Brian
                          Nov 9 '11 at 14:13










                        • It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                          – Joe Johnson 126
                          Nov 9 '11 at 14:40










                        • From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                          – Brian
                          Nov 9 '11 at 17:03















                        I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                        – Brian
                        Nov 9 '11 at 14:13




                        I'm starting to better understand how to read the equation, but you could point me to a resource that explains how to solve it?
                        – Brian
                        Nov 9 '11 at 14:13












                        It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                        – Joe Johnson 126
                        Nov 9 '11 at 14:40




                        It is called modular arithmetic. If you google it, you will find tons of resources. You can also start at wikipedia: en.wikipedia.org/wiki/Modular_arithmetic
                        – Joe Johnson 126
                        Nov 9 '11 at 14:40












                        This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                        – Joe Johnson 126
                        Nov 9 '11 at 14:40




                        This site seems helpful too: math.rutgers.edu/~erowland/modulararithmetic.html
                        – Joe Johnson 126
                        Nov 9 '11 at 14:40












                        From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                        – Brian
                        Nov 9 '11 at 17:03




                        From the article I read I saw modulo and assumed modular was something completely different. Thanks for the info.
                        – Brian
                        Nov 9 '11 at 17:03










                        up vote
                        0
                        down vote













                        I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,



                        5 % 4 = 1


                        This implies that $$5 equiv 1 qquad (textmod 4)$$
                        (It is not the same, however. See Michael Hardy's comments below.)



                        However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:



                        (note to anyone scanning, the following is intentionally incorrect)



                        13 * d = 1 mod 1680 = 1 % 1680 = 1


                        and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.



                        The original equation asks,



                        $$13 dequiv 1 qquad (operatornamemod 1680)$$



                        or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.



                        There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:



                        d=1
                        while (d * 13 % 1680 != 1):
                        d++


                        On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):



                        If we are looking for $d$ such that $13dequiv 1 quad (operatornamemod 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:



                        $$13d-1680k=1$$



                        This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.



                        Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.






                        share|cite|improve this answer


















                        • 1




                          5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                          – Michael Hardy
                          Nov 9 '11 at 19:26







                        • 1




                          Ah, I said the same, and I should have said implies.
                          – process91
                          Nov 9 '11 at 19:45















                        up vote
                        0
                        down vote













                        I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,



                        5 % 4 = 1


                        This implies that $$5 equiv 1 qquad (textmod 4)$$
                        (It is not the same, however. See Michael Hardy's comments below.)



                        However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:



                        (note to anyone scanning, the following is intentionally incorrect)



                        13 * d = 1 mod 1680 = 1 % 1680 = 1


                        and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.



                        The original equation asks,



                        $$13 dequiv 1 qquad (operatornamemod 1680)$$



                        or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.



                        There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:



                        d=1
                        while (d * 13 % 1680 != 1):
                        d++


                        On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):



                        If we are looking for $d$ such that $13dequiv 1 quad (operatornamemod 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:



                        $$13d-1680k=1$$



                        This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.



                        Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.






                        share|cite|improve this answer


















                        • 1




                          5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                          – Michael Hardy
                          Nov 9 '11 at 19:26







                        • 1




                          Ah, I said the same, and I should have said implies.
                          – process91
                          Nov 9 '11 at 19:45













                        up vote
                        0
                        down vote










                        up vote
                        0
                        down vote









                        I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,



                        5 % 4 = 1


                        This implies that $$5 equiv 1 qquad (textmod 4)$$
                        (It is not the same, however. See Michael Hardy's comments below.)



                        However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:



                        (note to anyone scanning, the following is intentionally incorrect)



                        13 * d = 1 mod 1680 = 1 % 1680 = 1


                        and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.



                        The original equation asks,



                        $$13 dequiv 1 qquad (operatornamemod 1680)$$



                        or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.



                        There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:



                        d=1
                        while (d * 13 % 1680 != 1):
                        d++


                        On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):



                        If we are looking for $d$ such that $13dequiv 1 quad (operatornamemod 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:



                        $$13d-1680k=1$$



                        This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.



                        Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.






                        share|cite|improve this answer














                        I think that you are interpreting the original statement incorrectly. Mod is, indeed, in most programming languages the binary operator %. So, for instance,



                        5 % 4 = 1


                        This implies that $$5 equiv 1 qquad (textmod 4)$$
                        (It is not the same, however. See Michael Hardy's comments below.)



                        However, this will not help you solve the original equation. My interpretation of your question leads me to believe that you tried something like this:



                        (note to anyone scanning, the following is intentionally incorrect)



                        13 * d = 1 mod 1680 = 1 % 1680 = 1


                        and then conclude that d=1/13. Similarly, your mod function mod(m,n) performs the equivalent operation, resulting again in 1/13.



                        The original equation asks,



                        $$13 dequiv 1 qquad (operatornamemod 1680)$$



                        or, what number, when multiplied by 13, is equivalent to 1 mod 1680? The first thing to realize is that, if 13 does not divide 1680, there are infinitely many numbers. Chances are, we want the smallest positive number for which this is true.



                        There are many, many ways to think about this. You could just start plugging in numbers, trying to find one which satisfies this condition. If you were doing this by hand, that would be a terrible way to go, however if you are programming it this won't take very long:



                        d=1
                        while (d * 13 % 1680 != 1):
                        d++


                        On the other hand, for really large numbers this is pretty inefficient. One approach is to rewrite your equation as an equivalent one (as pedja suggested):



                        If we are looking for $d$ such that $13dequiv 1 quad (operatornamemod 1680)$, then we are looking for a number $d$ such that $13d-1=1680k$ for some integer $k$. Let's rearrange that to make it:



                        $$13d-1680k=1$$



                        This is as a linear Diophantine equation, and one can use the Euclidean Algorithm to solve linear Diophantine equations. This approach is algorithmic in nature, so it could certainly be programmed.



                        Another method would be to use rules about the modulus to find one such $d$. This method works well by hand when the modulus is small, but I doubt it could be (easily) programmed. This relies more on your mathematical sense, to choose suitable operations which will eventually remove the multiplier of 13 on the left side.







                        share|cite|improve this answer














                        share|cite|improve this answer



                        share|cite|improve this answer








                        edited Nov 9 '11 at 19:52

























                        answered Nov 9 '11 at 14:25









                        process91

                        3,9141730




                        3,9141730







                        • 1




                          5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                          – Michael Hardy
                          Nov 9 '11 at 19:26







                        • 1




                          Ah, I said the same, and I should have said implies.
                          – process91
                          Nov 9 '11 at 19:45













                        • 1




                          5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                          – Michael Hardy
                          Nov 9 '11 at 19:26







                        • 1




                          Ah, I said the same, and I should have said implies.
                          – process91
                          Nov 9 '11 at 19:45








                        1




                        1




                        5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                        – Michael Hardy
                        Nov 9 '11 at 19:26





                        5 % 4 = 1 does not mean the same thing as $5equiv 1mod 4$, because it is true that, for example, $62 equiv 67mod 5$, but certainly not true that $62 % 5=67$.
                        – Michael Hardy
                        Nov 9 '11 at 19:26





                        1




                        1




                        Ah, I said the same, and I should have said implies.
                        – process91
                        Nov 9 '11 at 19:45





                        Ah, I said the same, and I should have said implies.
                        – process91
                        Nov 9 '11 at 19:45











                        up vote
                        0
                        down vote













                        $pmod 1680$ means you consider all integers that differ by a multiple of $1680$ to be equivalent. They form a ring, which means (like the integers) you can add, subtract, multiply, and maybe divide. If the modulus is prime, you have a field and can divide as well. In this case you can divide and $13*517=6721=4*1680+1$, so $13^-1=517.$ You will be able to do any division where the values are coprime to $1680$ (do not share any factors, which are $2,3,5,7$).






                        share|cite|improve this answer


























                          up vote
                          0
                          down vote













                          $pmod 1680$ means you consider all integers that differ by a multiple of $1680$ to be equivalent. They form a ring, which means (like the integers) you can add, subtract, multiply, and maybe divide. If the modulus is prime, you have a field and can divide as well. In this case you can divide and $13*517=6721=4*1680+1$, so $13^-1=517.$ You will be able to do any division where the values are coprime to $1680$ (do not share any factors, which are $2,3,5,7$).






                          share|cite|improve this answer
























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            $pmod 1680$ means you consider all integers that differ by a multiple of $1680$ to be equivalent. They form a ring, which means (like the integers) you can add, subtract, multiply, and maybe divide. If the modulus is prime, you have a field and can divide as well. In this case you can divide and $13*517=6721=4*1680+1$, so $13^-1=517.$ You will be able to do any division where the values are coprime to $1680$ (do not share any factors, which are $2,3,5,7$).






                            share|cite|improve this answer














                            $pmod 1680$ means you consider all integers that differ by a multiple of $1680$ to be equivalent. They form a ring, which means (like the integers) you can add, subtract, multiply, and maybe divide. If the modulus is prime, you have a field and can divide as well. In this case you can divide and $13*517=6721=4*1680+1$, so $13^-1=517.$ You will be able to do any division where the values are coprime to $1680$ (do not share any factors, which are $2,3,5,7$).







                            share|cite|improve this answer














                            share|cite|improve this answer



                            share|cite|improve this answer








                            edited Aug 21 at 8:46









                            Toby Mak

                            2,8051925




                            2,8051925










                            answered Nov 9 '11 at 14:09









                            Ross Millikan

                            278k21188354




                            278k21188354






















                                 

                                draft saved


                                draft discarded


























                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f80529%2fwhat-is-modulo-arithmetic%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                這個網誌中的熱門文章

                                How to combine Bézier curves to a surface?

                                Mutual Information Always Non-negative

                                Why am i infinitely getting the same tweet with the Twitter Search API?