Modular Arithmetic: solving a quadratic equation with a variable in the modulus












0














I am not an expert on modulus arithmetic and I am computer scientist looking to see if there is a better way to solve an equation in the form of



$$(x^2 + 43) mod (44-2x)=0$$



I am currently doing a linear search, I have other equations I am trying to solve other equations that are similar, but the search is becoming inefficient for large values. Any help would be appreciated.



The solutions to this equations are



$$x = -9,5,21,23$$










share|cite|improve this question
























  • Have you found any $x$ satisfying this so far?
    – ÍgjøgnumMeg
    Dec 29 '18 at 3:14










  • As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
    – Keith Backman
    Dec 29 '18 at 3:15
















0














I am not an expert on modulus arithmetic and I am computer scientist looking to see if there is a better way to solve an equation in the form of



$$(x^2 + 43) mod (44-2x)=0$$



I am currently doing a linear search, I have other equations I am trying to solve other equations that are similar, but the search is becoming inefficient for large values. Any help would be appreciated.



The solutions to this equations are



$$x = -9,5,21,23$$










share|cite|improve this question
























  • Have you found any $x$ satisfying this so far?
    – ÍgjøgnumMeg
    Dec 29 '18 at 3:14










  • As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
    – Keith Backman
    Dec 29 '18 at 3:15














0












0








0







I am not an expert on modulus arithmetic and I am computer scientist looking to see if there is a better way to solve an equation in the form of



$$(x^2 + 43) mod (44-2x)=0$$



I am currently doing a linear search, I have other equations I am trying to solve other equations that are similar, but the search is becoming inefficient for large values. Any help would be appreciated.



The solutions to this equations are



$$x = -9,5,21,23$$










share|cite|improve this question















I am not an expert on modulus arithmetic and I am computer scientist looking to see if there is a better way to solve an equation in the form of



$$(x^2 + 43) mod (44-2x)=0$$



I am currently doing a linear search, I have other equations I am trying to solve other equations that are similar, but the search is becoming inefficient for large values. Any help would be appreciated.



The solutions to this equations are



$$x = -9,5,21,23$$







elementary-number-theory modular-arithmetic






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 29 '18 at 13:34









Moo

5,53131020




5,53131020










asked Dec 29 '18 at 2:59









Ryan ToppsRyan Topps

124




124












  • Have you found any $x$ satisfying this so far?
    – ÍgjøgnumMeg
    Dec 29 '18 at 3:14










  • As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
    – Keith Backman
    Dec 29 '18 at 3:15


















  • Have you found any $x$ satisfying this so far?
    – ÍgjøgnumMeg
    Dec 29 '18 at 3:14










  • As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
    – Keith Backman
    Dec 29 '18 at 3:15
















Have you found any $x$ satisfying this so far?
– ÍgjøgnumMeg
Dec 29 '18 at 3:14




Have you found any $x$ satisfying this so far?
– ÍgjøgnumMeg
Dec 29 '18 at 3:14












As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
– Keith Backman
Dec 29 '18 at 3:15




As a start, note that if $x$ is even, then $x^2+43$ is always odd and $44-2x$ is always even, and there is no multiple of an even number that results in an odd number, i.e. leaving a residue of $0$.
– Keith Backman
Dec 29 '18 at 3:15










4 Answers
4






active

oldest

votes


















0














I assume that you're looking to solve the equation over the integers.



First notice that when $x$ is even, then $x^2+43$ is odd, but the modulus is even. (The modulus is always even.) Therefore in order for $x$ to be a solution, $x$ must be odd. Let $x=2k+1$ then, for some integer $k$. Let's see if that simplifies things.



We now have
$$4k^2+4k+44 equiv 0 pmod{2(2k-21)}.$$



Cancelling a $2$ from the equation and the modulus at the same time, we now have
$$2k^2+2k+22 equiv 0 pmod{2k-21},$$
which is much nicer.



The reason it's much nicer is that $2k-21$ has leading coefficient 2, which divides the leading coefficient of $2k^2+2k+22$. Thus, we can subtract the equation $(2k-21)k=2k^2-21kequiv 0$ to get
$$23k + 22 equiv 0 pmod{2k-21},$$
and now we can subtract $11(2k-21)= 22k-231equiv 0$
to get the equation
$$k+253equiv 0 pmod{2k-21}.$$



Now we rewrite this. We want to find for which $k$ there exist $q$ such that $k+253 = q(2k-21)$.



Rearranging, we have $(2q-1)k = 253+21q$



Thus, $k$ is a solution if and only if $k$ can be written as $frac{21q+253}{2q-1}=10+frac{q+263}{2q-1}$.



Thus we have reduced the question to figuring out when $frac{q+263}{2q-1}$ is an integer.



This is kind of a pain, so let's solve the much easier question of when it is an integer or a half integer, which we can solve by noting that in that case,
$$frac{2(q+263)}{2q-1}=frac{2q+526}{2q-1}=1+frac{527}{2q-1}$$ will be an integer. Thus $2q-1$ will be a factor of $527$.



Note that $527$ is odd, so that $527/(2q-1)$ will always be odd, so that the resulting integer will always be even. This means that no value of $q$ gave a half integer solution, so every possible value of $q$ gives a value of $x$.
The factors of 527 are $pm 1$,$pm 17$,$pm 31$, and $pm 527$,
corresponding to values for $q$ of $1,0,9,-8,16,-15$, $264$, and $-263$.



These give values of $k$ of $11,10,19,2,26,-5,274$, and $-253$.
Thus we get solutions for $x$ of $23,21,39,5,53,-9,549$, and $-505$.






share|cite|improve this answer





















  • Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
    – Ryan Topps
    Dec 29 '18 at 4:07










  • @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
    – jgon
    Dec 29 '18 at 4:10










  • I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
    – Ryan Topps
    Dec 29 '18 at 4:21










  • @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
    – Bill Dubuque
    Dec 29 '18 at 5:28



















1














Hint $, x!-!22mid x^2!+!43-(x!-!22)(x!+!22) = 527= 17cdot 31,$ so $,x, =, 22pm{1,17,31,527}$






share|cite|improve this answer































    0














    For $x=21$, $44-2x=2$ and the residue of any even number is $0mod 2$.



    $21^2+43$ is even.






    share|cite|improve this answer





















    • Yes I am was more concerned with finding the x values of -9,5,21,23
      – Ryan Topps
      Dec 29 '18 at 3:26












    • The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
      – Keith Backman
      Dec 29 '18 at 3:38



















    0














    Note that if



    $$x^2 + 43 equiv 0 pmod{44 - 2x} tag{1}label{eq1}$$



    then multiplying by $-2$ gives



    $$-2x^2 - 86 equiv 0 pmod{44 - 2x} tag{2}label{eq2}$$



    Also, dividing $44 - 2x$ into $-2x^2 - 86$ gives



    $$-2x^2 - 86 = left(x + 22right) left(44 - 2xright) - 1054 tag{3}label{eq3}$$



    Thus, your original equation can be simplified to just look for cases where



    $$-1054 equiv 0 pmod{44 - 2x} tag{4}label{eq4}$$



    As such, you only need to check cases where $44 - 2x$ is a factor of $1054 = 2 * 31 * 17$, in particular, $pm 1, pm 2, pm 31, pm 17, pm 62, pm 34, pm 527, pm 1054$. For each value $n$ among these factors, you can then solve for $x$ by using $x = 22 - frac{n}{2}$. As such, for integral values of $x$, the factor must be even, giving the results of $x = 21, 23, -9, 53, 5, 39, -505, 549$.



    Also, if you wish to avoid using negative modulus values, then you need to have $44 - 2x gt 0$, so $x lt 22$, giving the results of just $x = -505, -9, 5, 21$.






    share|cite|improve this answer























    • What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
      – Ryan Topps
      Dec 29 '18 at 3:45












    • @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
      – John Omielan
      Dec 29 '18 at 3:49










    • I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
      – Ryan Topps
      Dec 29 '18 at 3:56










    • @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
      – John Omielan
      Dec 29 '18 at 3:57











    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%2f3055496%2fmodular-arithmetic-solving-a-quadratic-equation-with-a-variable-in-the-modulus%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I assume that you're looking to solve the equation over the integers.



    First notice that when $x$ is even, then $x^2+43$ is odd, but the modulus is even. (The modulus is always even.) Therefore in order for $x$ to be a solution, $x$ must be odd. Let $x=2k+1$ then, for some integer $k$. Let's see if that simplifies things.



    We now have
    $$4k^2+4k+44 equiv 0 pmod{2(2k-21)}.$$



    Cancelling a $2$ from the equation and the modulus at the same time, we now have
    $$2k^2+2k+22 equiv 0 pmod{2k-21},$$
    which is much nicer.



    The reason it's much nicer is that $2k-21$ has leading coefficient 2, which divides the leading coefficient of $2k^2+2k+22$. Thus, we can subtract the equation $(2k-21)k=2k^2-21kequiv 0$ to get
    $$23k + 22 equiv 0 pmod{2k-21},$$
    and now we can subtract $11(2k-21)= 22k-231equiv 0$
    to get the equation
    $$k+253equiv 0 pmod{2k-21}.$$



    Now we rewrite this. We want to find for which $k$ there exist $q$ such that $k+253 = q(2k-21)$.



    Rearranging, we have $(2q-1)k = 253+21q$



    Thus, $k$ is a solution if and only if $k$ can be written as $frac{21q+253}{2q-1}=10+frac{q+263}{2q-1}$.



    Thus we have reduced the question to figuring out when $frac{q+263}{2q-1}$ is an integer.



    This is kind of a pain, so let's solve the much easier question of when it is an integer or a half integer, which we can solve by noting that in that case,
    $$frac{2(q+263)}{2q-1}=frac{2q+526}{2q-1}=1+frac{527}{2q-1}$$ will be an integer. Thus $2q-1$ will be a factor of $527$.



    Note that $527$ is odd, so that $527/(2q-1)$ will always be odd, so that the resulting integer will always be even. This means that no value of $q$ gave a half integer solution, so every possible value of $q$ gives a value of $x$.
    The factors of 527 are $pm 1$,$pm 17$,$pm 31$, and $pm 527$,
    corresponding to values for $q$ of $1,0,9,-8,16,-15$, $264$, and $-263$.



    These give values of $k$ of $11,10,19,2,26,-5,274$, and $-253$.
    Thus we get solutions for $x$ of $23,21,39,5,53,-9,549$, and $-505$.






    share|cite|improve this answer





















    • Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
      – Ryan Topps
      Dec 29 '18 at 4:07










    • @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
      – jgon
      Dec 29 '18 at 4:10










    • I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
      – Ryan Topps
      Dec 29 '18 at 4:21










    • @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
      – Bill Dubuque
      Dec 29 '18 at 5:28
















    0














    I assume that you're looking to solve the equation over the integers.



    First notice that when $x$ is even, then $x^2+43$ is odd, but the modulus is even. (The modulus is always even.) Therefore in order for $x$ to be a solution, $x$ must be odd. Let $x=2k+1$ then, for some integer $k$. Let's see if that simplifies things.



    We now have
    $$4k^2+4k+44 equiv 0 pmod{2(2k-21)}.$$



    Cancelling a $2$ from the equation and the modulus at the same time, we now have
    $$2k^2+2k+22 equiv 0 pmod{2k-21},$$
    which is much nicer.



    The reason it's much nicer is that $2k-21$ has leading coefficient 2, which divides the leading coefficient of $2k^2+2k+22$. Thus, we can subtract the equation $(2k-21)k=2k^2-21kequiv 0$ to get
    $$23k + 22 equiv 0 pmod{2k-21},$$
    and now we can subtract $11(2k-21)= 22k-231equiv 0$
    to get the equation
    $$k+253equiv 0 pmod{2k-21}.$$



    Now we rewrite this. We want to find for which $k$ there exist $q$ such that $k+253 = q(2k-21)$.



    Rearranging, we have $(2q-1)k = 253+21q$



    Thus, $k$ is a solution if and only if $k$ can be written as $frac{21q+253}{2q-1}=10+frac{q+263}{2q-1}$.



    Thus we have reduced the question to figuring out when $frac{q+263}{2q-1}$ is an integer.



    This is kind of a pain, so let's solve the much easier question of when it is an integer or a half integer, which we can solve by noting that in that case,
    $$frac{2(q+263)}{2q-1}=frac{2q+526}{2q-1}=1+frac{527}{2q-1}$$ will be an integer. Thus $2q-1$ will be a factor of $527$.



    Note that $527$ is odd, so that $527/(2q-1)$ will always be odd, so that the resulting integer will always be even. This means that no value of $q$ gave a half integer solution, so every possible value of $q$ gives a value of $x$.
    The factors of 527 are $pm 1$,$pm 17$,$pm 31$, and $pm 527$,
    corresponding to values for $q$ of $1,0,9,-8,16,-15$, $264$, and $-263$.



    These give values of $k$ of $11,10,19,2,26,-5,274$, and $-253$.
    Thus we get solutions for $x$ of $23,21,39,5,53,-9,549$, and $-505$.






    share|cite|improve this answer





















    • Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
      – Ryan Topps
      Dec 29 '18 at 4:07










    • @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
      – jgon
      Dec 29 '18 at 4:10










    • I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
      – Ryan Topps
      Dec 29 '18 at 4:21










    • @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
      – Bill Dubuque
      Dec 29 '18 at 5:28














    0












    0








    0






    I assume that you're looking to solve the equation over the integers.



    First notice that when $x$ is even, then $x^2+43$ is odd, but the modulus is even. (The modulus is always even.) Therefore in order for $x$ to be a solution, $x$ must be odd. Let $x=2k+1$ then, for some integer $k$. Let's see if that simplifies things.



    We now have
    $$4k^2+4k+44 equiv 0 pmod{2(2k-21)}.$$



    Cancelling a $2$ from the equation and the modulus at the same time, we now have
    $$2k^2+2k+22 equiv 0 pmod{2k-21},$$
    which is much nicer.



    The reason it's much nicer is that $2k-21$ has leading coefficient 2, which divides the leading coefficient of $2k^2+2k+22$. Thus, we can subtract the equation $(2k-21)k=2k^2-21kequiv 0$ to get
    $$23k + 22 equiv 0 pmod{2k-21},$$
    and now we can subtract $11(2k-21)= 22k-231equiv 0$
    to get the equation
    $$k+253equiv 0 pmod{2k-21}.$$



    Now we rewrite this. We want to find for which $k$ there exist $q$ such that $k+253 = q(2k-21)$.



    Rearranging, we have $(2q-1)k = 253+21q$



    Thus, $k$ is a solution if and only if $k$ can be written as $frac{21q+253}{2q-1}=10+frac{q+263}{2q-1}$.



    Thus we have reduced the question to figuring out when $frac{q+263}{2q-1}$ is an integer.



    This is kind of a pain, so let's solve the much easier question of when it is an integer or a half integer, which we can solve by noting that in that case,
    $$frac{2(q+263)}{2q-1}=frac{2q+526}{2q-1}=1+frac{527}{2q-1}$$ will be an integer. Thus $2q-1$ will be a factor of $527$.



    Note that $527$ is odd, so that $527/(2q-1)$ will always be odd, so that the resulting integer will always be even. This means that no value of $q$ gave a half integer solution, so every possible value of $q$ gives a value of $x$.
    The factors of 527 are $pm 1$,$pm 17$,$pm 31$, and $pm 527$,
    corresponding to values for $q$ of $1,0,9,-8,16,-15$, $264$, and $-263$.



    These give values of $k$ of $11,10,19,2,26,-5,274$, and $-253$.
    Thus we get solutions for $x$ of $23,21,39,5,53,-9,549$, and $-505$.






    share|cite|improve this answer












    I assume that you're looking to solve the equation over the integers.



    First notice that when $x$ is even, then $x^2+43$ is odd, but the modulus is even. (The modulus is always even.) Therefore in order for $x$ to be a solution, $x$ must be odd. Let $x=2k+1$ then, for some integer $k$. Let's see if that simplifies things.



    We now have
    $$4k^2+4k+44 equiv 0 pmod{2(2k-21)}.$$



    Cancelling a $2$ from the equation and the modulus at the same time, we now have
    $$2k^2+2k+22 equiv 0 pmod{2k-21},$$
    which is much nicer.



    The reason it's much nicer is that $2k-21$ has leading coefficient 2, which divides the leading coefficient of $2k^2+2k+22$. Thus, we can subtract the equation $(2k-21)k=2k^2-21kequiv 0$ to get
    $$23k + 22 equiv 0 pmod{2k-21},$$
    and now we can subtract $11(2k-21)= 22k-231equiv 0$
    to get the equation
    $$k+253equiv 0 pmod{2k-21}.$$



    Now we rewrite this. We want to find for which $k$ there exist $q$ such that $k+253 = q(2k-21)$.



    Rearranging, we have $(2q-1)k = 253+21q$



    Thus, $k$ is a solution if and only if $k$ can be written as $frac{21q+253}{2q-1}=10+frac{q+263}{2q-1}$.



    Thus we have reduced the question to figuring out when $frac{q+263}{2q-1}$ is an integer.



    This is kind of a pain, so let's solve the much easier question of when it is an integer or a half integer, which we can solve by noting that in that case,
    $$frac{2(q+263)}{2q-1}=frac{2q+526}{2q-1}=1+frac{527}{2q-1}$$ will be an integer. Thus $2q-1$ will be a factor of $527$.



    Note that $527$ is odd, so that $527/(2q-1)$ will always be odd, so that the resulting integer will always be even. This means that no value of $q$ gave a half integer solution, so every possible value of $q$ gives a value of $x$.
    The factors of 527 are $pm 1$,$pm 17$,$pm 31$, and $pm 527$,
    corresponding to values for $q$ of $1,0,9,-8,16,-15$, $264$, and $-263$.



    These give values of $k$ of $11,10,19,2,26,-5,274$, and $-253$.
    Thus we get solutions for $x$ of $23,21,39,5,53,-9,549$, and $-505$.







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered Dec 29 '18 at 3:53









    jgonjgon

    13.4k22041




    13.4k22041












    • Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
      – Ryan Topps
      Dec 29 '18 at 4:07










    • @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
      – jgon
      Dec 29 '18 at 4:10










    • I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
      – Ryan Topps
      Dec 29 '18 at 4:21










    • @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
      – Bill Dubuque
      Dec 29 '18 at 5:28


















    • Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
      – Ryan Topps
      Dec 29 '18 at 4:07










    • @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
      – jgon
      Dec 29 '18 at 4:10










    • I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
      – Ryan Topps
      Dec 29 '18 at 4:21










    • @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
      – Bill Dubuque
      Dec 29 '18 at 5:28
















    Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
    – Ryan Topps
    Dec 29 '18 at 4:07




    Could explain where you get the form for the k solutions as $21q+2532/q−1=10+q+2632/q−1$
    – Ryan Topps
    Dec 29 '18 at 4:07












    @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
    – jgon
    Dec 29 '18 at 4:10




    @RyanTopps, to get the first thing, I took the equation on the line above and divided by $2q-1$, then I simplified by doing polynomial long division of the numerator by the denominator. Try finding a common denominator on the right hand side to check that the lhs and rhs are equal.
    – jgon
    Dec 29 '18 at 4:10












    I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
    – Ryan Topps
    Dec 29 '18 at 4:21




    I appreciate the effort. Unfortunately getting prime factors will be even harder than a search at large values, but your replacements showed me how to scan more effectively so thank you.
    – Ryan Topps
    Dec 29 '18 at 4:21












    @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
    – Bill Dubuque
    Dec 29 '18 at 5:28




    @Ryan Prime factorization is required to solve such problems, but we can do the rest more quickly - see my answer.
    – Bill Dubuque
    Dec 29 '18 at 5:28











    1














    Hint $, x!-!22mid x^2!+!43-(x!-!22)(x!+!22) = 527= 17cdot 31,$ so $,x, =, 22pm{1,17,31,527}$






    share|cite|improve this answer




























      1














      Hint $, x!-!22mid x^2!+!43-(x!-!22)(x!+!22) = 527= 17cdot 31,$ so $,x, =, 22pm{1,17,31,527}$






      share|cite|improve this answer


























        1












        1








        1






        Hint $, x!-!22mid x^2!+!43-(x!-!22)(x!+!22) = 527= 17cdot 31,$ so $,x, =, 22pm{1,17,31,527}$






        share|cite|improve this answer














        Hint $, x!-!22mid x^2!+!43-(x!-!22)(x!+!22) = 527= 17cdot 31,$ so $,x, =, 22pm{1,17,31,527}$







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Dec 29 '18 at 5:10

























        answered Dec 29 '18 at 5:02









        Bill DubuqueBill Dubuque

        209k29190631




        209k29190631























            0














            For $x=21$, $44-2x=2$ and the residue of any even number is $0mod 2$.



            $21^2+43$ is even.






            share|cite|improve this answer





















            • Yes I am was more concerned with finding the x values of -9,5,21,23
              – Ryan Topps
              Dec 29 '18 at 3:26












            • The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
              – Keith Backman
              Dec 29 '18 at 3:38
















            0














            For $x=21$, $44-2x=2$ and the residue of any even number is $0mod 2$.



            $21^2+43$ is even.






            share|cite|improve this answer





















            • Yes I am was more concerned with finding the x values of -9,5,21,23
              – Ryan Topps
              Dec 29 '18 at 3:26












            • The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
              – Keith Backman
              Dec 29 '18 at 3:38














            0












            0








            0






            For $x=21$, $44-2x=2$ and the residue of any even number is $0mod 2$.



            $21^2+43$ is even.






            share|cite|improve this answer












            For $x=21$, $44-2x=2$ and the residue of any even number is $0mod 2$.



            $21^2+43$ is even.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Dec 29 '18 at 3:20









            Keith BackmanKeith Backman

            1,0791712




            1,0791712












            • Yes I am was more concerned with finding the x values of -9,5,21,23
              – Ryan Topps
              Dec 29 '18 at 3:26












            • The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
              – Keith Backman
              Dec 29 '18 at 3:38


















            • Yes I am was more concerned with finding the x values of -9,5,21,23
              – Ryan Topps
              Dec 29 '18 at 3:26












            • The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
              – Keith Backman
              Dec 29 '18 at 3:38
















            Yes I am was more concerned with finding the x values of -9,5,21,23
            – Ryan Topps
            Dec 29 '18 at 3:26






            Yes I am was more concerned with finding the x values of -9,5,21,23
            – Ryan Topps
            Dec 29 '18 at 3:26














            The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
            – Keith Backman
            Dec 29 '18 at 3:38




            The value $23$ results in a negative modulus $(-2)$ which is a highly unusual usage.
            – Keith Backman
            Dec 29 '18 at 3:38











            0














            Note that if



            $$x^2 + 43 equiv 0 pmod{44 - 2x} tag{1}label{eq1}$$



            then multiplying by $-2$ gives



            $$-2x^2 - 86 equiv 0 pmod{44 - 2x} tag{2}label{eq2}$$



            Also, dividing $44 - 2x$ into $-2x^2 - 86$ gives



            $$-2x^2 - 86 = left(x + 22right) left(44 - 2xright) - 1054 tag{3}label{eq3}$$



            Thus, your original equation can be simplified to just look for cases where



            $$-1054 equiv 0 pmod{44 - 2x} tag{4}label{eq4}$$



            As such, you only need to check cases where $44 - 2x$ is a factor of $1054 = 2 * 31 * 17$, in particular, $pm 1, pm 2, pm 31, pm 17, pm 62, pm 34, pm 527, pm 1054$. For each value $n$ among these factors, you can then solve for $x$ by using $x = 22 - frac{n}{2}$. As such, for integral values of $x$, the factor must be even, giving the results of $x = 21, 23, -9, 53, 5, 39, -505, 549$.



            Also, if you wish to avoid using negative modulus values, then you need to have $44 - 2x gt 0$, so $x lt 22$, giving the results of just $x = -505, -9, 5, 21$.






            share|cite|improve this answer























            • What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
              – Ryan Topps
              Dec 29 '18 at 3:45












            • @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
              – John Omielan
              Dec 29 '18 at 3:49










            • I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
              – Ryan Topps
              Dec 29 '18 at 3:56










            • @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
              – John Omielan
              Dec 29 '18 at 3:57
















            0














            Note that if



            $$x^2 + 43 equiv 0 pmod{44 - 2x} tag{1}label{eq1}$$



            then multiplying by $-2$ gives



            $$-2x^2 - 86 equiv 0 pmod{44 - 2x} tag{2}label{eq2}$$



            Also, dividing $44 - 2x$ into $-2x^2 - 86$ gives



            $$-2x^2 - 86 = left(x + 22right) left(44 - 2xright) - 1054 tag{3}label{eq3}$$



            Thus, your original equation can be simplified to just look for cases where



            $$-1054 equiv 0 pmod{44 - 2x} tag{4}label{eq4}$$



            As such, you only need to check cases where $44 - 2x$ is a factor of $1054 = 2 * 31 * 17$, in particular, $pm 1, pm 2, pm 31, pm 17, pm 62, pm 34, pm 527, pm 1054$. For each value $n$ among these factors, you can then solve for $x$ by using $x = 22 - frac{n}{2}$. As such, for integral values of $x$, the factor must be even, giving the results of $x = 21, 23, -9, 53, 5, 39, -505, 549$.



            Also, if you wish to avoid using negative modulus values, then you need to have $44 - 2x gt 0$, so $x lt 22$, giving the results of just $x = -505, -9, 5, 21$.






            share|cite|improve this answer























            • What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
              – Ryan Topps
              Dec 29 '18 at 3:45












            • @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
              – John Omielan
              Dec 29 '18 at 3:49










            • I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
              – Ryan Topps
              Dec 29 '18 at 3:56










            • @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
              – John Omielan
              Dec 29 '18 at 3:57














            0












            0








            0






            Note that if



            $$x^2 + 43 equiv 0 pmod{44 - 2x} tag{1}label{eq1}$$



            then multiplying by $-2$ gives



            $$-2x^2 - 86 equiv 0 pmod{44 - 2x} tag{2}label{eq2}$$



            Also, dividing $44 - 2x$ into $-2x^2 - 86$ gives



            $$-2x^2 - 86 = left(x + 22right) left(44 - 2xright) - 1054 tag{3}label{eq3}$$



            Thus, your original equation can be simplified to just look for cases where



            $$-1054 equiv 0 pmod{44 - 2x} tag{4}label{eq4}$$



            As such, you only need to check cases where $44 - 2x$ is a factor of $1054 = 2 * 31 * 17$, in particular, $pm 1, pm 2, pm 31, pm 17, pm 62, pm 34, pm 527, pm 1054$. For each value $n$ among these factors, you can then solve for $x$ by using $x = 22 - frac{n}{2}$. As such, for integral values of $x$, the factor must be even, giving the results of $x = 21, 23, -9, 53, 5, 39, -505, 549$.



            Also, if you wish to avoid using negative modulus values, then you need to have $44 - 2x gt 0$, so $x lt 22$, giving the results of just $x = -505, -9, 5, 21$.






            share|cite|improve this answer














            Note that if



            $$x^2 + 43 equiv 0 pmod{44 - 2x} tag{1}label{eq1}$$



            then multiplying by $-2$ gives



            $$-2x^2 - 86 equiv 0 pmod{44 - 2x} tag{2}label{eq2}$$



            Also, dividing $44 - 2x$ into $-2x^2 - 86$ gives



            $$-2x^2 - 86 = left(x + 22right) left(44 - 2xright) - 1054 tag{3}label{eq3}$$



            Thus, your original equation can be simplified to just look for cases where



            $$-1054 equiv 0 pmod{44 - 2x} tag{4}label{eq4}$$



            As such, you only need to check cases where $44 - 2x$ is a factor of $1054 = 2 * 31 * 17$, in particular, $pm 1, pm 2, pm 31, pm 17, pm 62, pm 34, pm 527, pm 1054$. For each value $n$ among these factors, you can then solve for $x$ by using $x = 22 - frac{n}{2}$. As such, for integral values of $x$, the factor must be even, giving the results of $x = 21, 23, -9, 53, 5, 39, -505, 549$.



            Also, if you wish to avoid using negative modulus values, then you need to have $44 - 2x gt 0$, so $x lt 22$, giving the results of just $x = -505, -9, 5, 21$.







            share|cite|improve this answer














            share|cite|improve this answer



            share|cite|improve this answer








            edited Dec 29 '18 at 4:00

























            answered Dec 29 '18 at 3:25









            John OmielanJohn Omielan

            1,27618




            1,27618












            • What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
              – Ryan Topps
              Dec 29 '18 at 3:45












            • @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
              – John Omielan
              Dec 29 '18 at 3:49










            • I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
              – Ryan Topps
              Dec 29 '18 at 3:56










            • @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
              – John Omielan
              Dec 29 '18 at 3:57


















            • What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
              – Ryan Topps
              Dec 29 '18 at 3:45












            • @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
              – John Omielan
              Dec 29 '18 at 3:49










            • I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
              – Ryan Topps
              Dec 29 '18 at 3:56










            • @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
              – John Omielan
              Dec 29 '18 at 3:57
















            What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
            – Ryan Topps
            Dec 29 '18 at 3:45






            What you showed me with this that all answers comes in pairs where their sum is 44, which is a quite interesting approach.
            – Ryan Topps
            Dec 29 '18 at 3:45














            @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
            – John Omielan
            Dec 29 '18 at 3:49




            @RyanTopps In general, I am showing here that if you have a quadratic equation of a square term and a constant on the left, and a linear equation as the modulus, you can simplify it to just a constant, as I have shown here. I could have done it for a more general case, but I thought it would be simpler, and possibly more useful, to show the specific case you asked for. I hope you can see how this technique works so you can apply it in any other similar situations.
            – John Omielan
            Dec 29 '18 at 3:49












            I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
            – Ryan Topps
            Dec 29 '18 at 3:56




            I appreciate it, its just to find prime factors is not an easy solution in programming. I am merely looking a way for me to "cheat" so to say so I do not have to scan from 0 to 44. Basically calculating the modulus is one of the fastest operations.
            – Ryan Topps
            Dec 29 '18 at 3:56












            @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
            – John Omielan
            Dec 29 '18 at 3:57




            @RyanTopps Note that your solution doesn't include the answer of $-505$. If you plug it into your original equation, the the modulus becomes $1054$, with the left side becomes $255068 = 242 times 1054$.
            – John Omielan
            Dec 29 '18 at 3:57


















            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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.


            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%2f3055496%2fmodular-arithmetic-solving-a-quadratic-equation-with-a-variable-in-the-modulus%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

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅