Can x mod (N - a) or x mod (N + a) be calculated just by knowing x mod N??












1












$begingroup$


Can x mod (N - a) or x mod (N + a) be calculated just by knowing x mod N? where a is an arbitrary integer, and N is a prime. e.g. i know 22! mod 23 ≡ 22 using Wilson's theorem. lets say i want to know 22! mod 24, is there a way i can do so without solving the factorial?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I added an answer which discusses the general case.
    $endgroup$
    – Bill Dubuque
    Jan 8 at 20:21
















1












$begingroup$


Can x mod (N - a) or x mod (N + a) be calculated just by knowing x mod N? where a is an arbitrary integer, and N is a prime. e.g. i know 22! mod 23 ≡ 22 using Wilson's theorem. lets say i want to know 22! mod 24, is there a way i can do so without solving the factorial?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I added an answer which discusses the general case.
    $endgroup$
    – Bill Dubuque
    Jan 8 at 20:21














1












1








1





$begingroup$


Can x mod (N - a) or x mod (N + a) be calculated just by knowing x mod N? where a is an arbitrary integer, and N is a prime. e.g. i know 22! mod 23 ≡ 22 using Wilson's theorem. lets say i want to know 22! mod 24, is there a way i can do so without solving the factorial?










share|cite|improve this question











$endgroup$




Can x mod (N - a) or x mod (N + a) be calculated just by knowing x mod N? where a is an arbitrary integer, and N is a prime. e.g. i know 22! mod 23 ≡ 22 using Wilson's theorem. lets say i want to know 22! mod 24, is there a way i can do so without solving the factorial?







modular-arithmetic factorial






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 8 at 15:04







Malik Hamza Murtaza

















asked Jan 8 at 14:57









Malik Hamza MurtazaMalik Hamza Murtaza

317




317












  • $begingroup$
    I added an answer which discusses the general case.
    $endgroup$
    – Bill Dubuque
    Jan 8 at 20:21


















  • $begingroup$
    I added an answer which discusses the general case.
    $endgroup$
    – Bill Dubuque
    Jan 8 at 20:21
















$begingroup$
I added an answer which discusses the general case.
$endgroup$
– Bill Dubuque
Jan 8 at 20:21




$begingroup$
I added an answer which discusses the general case.
$endgroup$
– Bill Dubuque
Jan 8 at 20:21










2 Answers
2






active

oldest

votes


















1












$begingroup$

If $,d := gcd(n,m)=1,$ then there is no relationship between $,a = xbmod n,$ and $, b = xbmod m,$ since CRT $,Rightarrow,xequiv apmod{!n}, xequiv bpmod{! m} $ is solvable for all values of $,a,b.,$ This is true in your example $iff 1 = gcd(n,npm a) = gcd(n,a).$



However, when $,d > 1,$a solution exists iff $,bequiv apmod{!d},,$ and this does place constraints on the values $,b,$ that $,x,$ can take $!bmod m$. Then $,b,$ is determined uniquely iff $,mmid diff mmid n $ (i.e. iff $,npm amid n,$ in your example), hence $,xbmod m = (xbmod n)bmod m,$ is uniquely determined. This arises frequently, e.g. knowing $, u = xbmod 10 = $ units digit of $x$ we can compute its parity by taking the parity of its units digit, i.e. $ xbmod 2 = (xbmod 10)bmod 2 = ubmod 2,,$ e.g. $,123bmod 2 = 3bmod 2 = 1$.






share|cite|improve this answer











$endgroup$





















    1












    $begingroup$

    For the specific case $22!$, the answer is easy: since $4 leq 22$ and $6 leq 22$ you have that $22! = 0 pmod{24}$. However, we didn't use the fact we got from Wilson's Theorem, and it doesn't help us in general.



    The answer to your question is no, and here is an illustrative example: suppose you know that $x = 5 pmod{10}$. Then you could have, among many options, that $x = 5$, or that $x = 15$. In the former case, $x = 5 pmod{12}$. In the latter case, $x = 3 pmod{12}$.






    share|cite|improve this answer









    $endgroup$













    • $begingroup$
      But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
      $endgroup$
      – Bill Dubuque
      Jan 8 at 20:24











    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    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%2f3066267%2fcan-x-mod-n-a-or-x-mod-n-a-be-calculated-just-by-knowing-x-mod-n%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1












    $begingroup$

    If $,d := gcd(n,m)=1,$ then there is no relationship between $,a = xbmod n,$ and $, b = xbmod m,$ since CRT $,Rightarrow,xequiv apmod{!n}, xequiv bpmod{! m} $ is solvable for all values of $,a,b.,$ This is true in your example $iff 1 = gcd(n,npm a) = gcd(n,a).$



    However, when $,d > 1,$a solution exists iff $,bequiv apmod{!d},,$ and this does place constraints on the values $,b,$ that $,x,$ can take $!bmod m$. Then $,b,$ is determined uniquely iff $,mmid diff mmid n $ (i.e. iff $,npm amid n,$ in your example), hence $,xbmod m = (xbmod n)bmod m,$ is uniquely determined. This arises frequently, e.g. knowing $, u = xbmod 10 = $ units digit of $x$ we can compute its parity by taking the parity of its units digit, i.e. $ xbmod 2 = (xbmod 10)bmod 2 = ubmod 2,,$ e.g. $,123bmod 2 = 3bmod 2 = 1$.






    share|cite|improve this answer











    $endgroup$


















      1












      $begingroup$

      If $,d := gcd(n,m)=1,$ then there is no relationship between $,a = xbmod n,$ and $, b = xbmod m,$ since CRT $,Rightarrow,xequiv apmod{!n}, xequiv bpmod{! m} $ is solvable for all values of $,a,b.,$ This is true in your example $iff 1 = gcd(n,npm a) = gcd(n,a).$



      However, when $,d > 1,$a solution exists iff $,bequiv apmod{!d},,$ and this does place constraints on the values $,b,$ that $,x,$ can take $!bmod m$. Then $,b,$ is determined uniquely iff $,mmid diff mmid n $ (i.e. iff $,npm amid n,$ in your example), hence $,xbmod m = (xbmod n)bmod m,$ is uniquely determined. This arises frequently, e.g. knowing $, u = xbmod 10 = $ units digit of $x$ we can compute its parity by taking the parity of its units digit, i.e. $ xbmod 2 = (xbmod 10)bmod 2 = ubmod 2,,$ e.g. $,123bmod 2 = 3bmod 2 = 1$.






      share|cite|improve this answer











      $endgroup$
















        1












        1








        1





        $begingroup$

        If $,d := gcd(n,m)=1,$ then there is no relationship between $,a = xbmod n,$ and $, b = xbmod m,$ since CRT $,Rightarrow,xequiv apmod{!n}, xequiv bpmod{! m} $ is solvable for all values of $,a,b.,$ This is true in your example $iff 1 = gcd(n,npm a) = gcd(n,a).$



        However, when $,d > 1,$a solution exists iff $,bequiv apmod{!d},,$ and this does place constraints on the values $,b,$ that $,x,$ can take $!bmod m$. Then $,b,$ is determined uniquely iff $,mmid diff mmid n $ (i.e. iff $,npm amid n,$ in your example), hence $,xbmod m = (xbmod n)bmod m,$ is uniquely determined. This arises frequently, e.g. knowing $, u = xbmod 10 = $ units digit of $x$ we can compute its parity by taking the parity of its units digit, i.e. $ xbmod 2 = (xbmod 10)bmod 2 = ubmod 2,,$ e.g. $,123bmod 2 = 3bmod 2 = 1$.






        share|cite|improve this answer











        $endgroup$



        If $,d := gcd(n,m)=1,$ then there is no relationship between $,a = xbmod n,$ and $, b = xbmod m,$ since CRT $,Rightarrow,xequiv apmod{!n}, xequiv bpmod{! m} $ is solvable for all values of $,a,b.,$ This is true in your example $iff 1 = gcd(n,npm a) = gcd(n,a).$



        However, when $,d > 1,$a solution exists iff $,bequiv apmod{!d},,$ and this does place constraints on the values $,b,$ that $,x,$ can take $!bmod m$. Then $,b,$ is determined uniquely iff $,mmid diff mmid n $ (i.e. iff $,npm amid n,$ in your example), hence $,xbmod m = (xbmod n)bmod m,$ is uniquely determined. This arises frequently, e.g. knowing $, u = xbmod 10 = $ units digit of $x$ we can compute its parity by taking the parity of its units digit, i.e. $ xbmod 2 = (xbmod 10)bmod 2 = ubmod 2,,$ e.g. $,123bmod 2 = 3bmod 2 = 1$.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Jan 8 at 20:33

























        answered Jan 8 at 20:21









        Bill DubuqueBill Dubuque

        209k29191633




        209k29191633























            1












            $begingroup$

            For the specific case $22!$, the answer is easy: since $4 leq 22$ and $6 leq 22$ you have that $22! = 0 pmod{24}$. However, we didn't use the fact we got from Wilson's Theorem, and it doesn't help us in general.



            The answer to your question is no, and here is an illustrative example: suppose you know that $x = 5 pmod{10}$. Then you could have, among many options, that $x = 5$, or that $x = 15$. In the former case, $x = 5 pmod{12}$. In the latter case, $x = 3 pmod{12}$.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
              $endgroup$
              – Bill Dubuque
              Jan 8 at 20:24
















            1












            $begingroup$

            For the specific case $22!$, the answer is easy: since $4 leq 22$ and $6 leq 22$ you have that $22! = 0 pmod{24}$. However, we didn't use the fact we got from Wilson's Theorem, and it doesn't help us in general.



            The answer to your question is no, and here is an illustrative example: suppose you know that $x = 5 pmod{10}$. Then you could have, among many options, that $x = 5$, or that $x = 15$. In the former case, $x = 5 pmod{12}$. In the latter case, $x = 3 pmod{12}$.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
              $endgroup$
              – Bill Dubuque
              Jan 8 at 20:24














            1












            1








            1





            $begingroup$

            For the specific case $22!$, the answer is easy: since $4 leq 22$ and $6 leq 22$ you have that $22! = 0 pmod{24}$. However, we didn't use the fact we got from Wilson's Theorem, and it doesn't help us in general.



            The answer to your question is no, and here is an illustrative example: suppose you know that $x = 5 pmod{10}$. Then you could have, among many options, that $x = 5$, or that $x = 15$. In the former case, $x = 5 pmod{12}$. In the latter case, $x = 3 pmod{12}$.






            share|cite|improve this answer









            $endgroup$



            For the specific case $22!$, the answer is easy: since $4 leq 22$ and $6 leq 22$ you have that $22! = 0 pmod{24}$. However, we didn't use the fact we got from Wilson's Theorem, and it doesn't help us in general.



            The answer to your question is no, and here is an illustrative example: suppose you know that $x = 5 pmod{10}$. Then you could have, among many options, that $x = 5$, or that $x = 15$. In the former case, $x = 5 pmod{12}$. In the latter case, $x = 3 pmod{12}$.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 8 at 15:07









            Mees de VriesMees de Vries

            16.4k12654




            16.4k12654












            • $begingroup$
              But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
              $endgroup$
              – Bill Dubuque
              Jan 8 at 20:24


















            • $begingroup$
              But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
              $endgroup$
              – Bill Dubuque
              Jan 8 at 20:24
















            $begingroup$
            But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
            $endgroup$
            – Bill Dubuque
            Jan 8 at 20:24




            $begingroup$
            But the answer can be yes too, e.g. $,n=10, n−a=5. $ See my answer for the general case.
            $endgroup$
            – Bill Dubuque
            Jan 8 at 20:24


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3066267%2fcan-x-mod-n-a-or-x-mod-n-a-be-calculated-just-by-knowing-x-mod-n%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Mario Kart Wii

            The Binding of Isaac: Rebirth/Afterbirth

            What does “Dominus providebit” mean?