Chinese remainder theorem and Diophantine equation implementation











up vote
0
down vote

favorite












I needed an advise on implementing and solving one problem and the others like. I came across two sentences that I think will be helpful. Those are the Chinese remainder theorem and the Diofantic equation, but I do not know exactly how do I apply them to the problem.



Let me introduce this problem f.e. on the sewer pipe, I will try to describe it as a verbal task:



We need to design a sewer pipeline with an exact length of 127 m. We have tubes from 3 different suppliers. Each supplier produces tubes of different fixed lengths that can not be shortened or extended in any way:



first supplier: 12 m



second supplier: 8 m



third supplier: 10 m



At the beginning of the pipeline and at the end of the pipeline there must be bridging pipes having a length of 3 m. Between each and every tube must also be a bridging pipe.



To illustrate this, we'll show the lengths as variables:



(first supplier) X = 12 m



(second supplier) Y = 8 m



(third supplier) Z = 10 m



(bridging pipe) A = 3 m



Therefore, the scheme would be something like this:



A Y A Y A Y A Y A Z A X A X A



We ask how many tubes do we need to order from every supplier and how many solutions there are? Consider these solutions as a number of different admissible orders (one solution may look like f.e from the first sup. we'll order 5, from the second 3 and from the third 7). The bridging pipes are always sufficient and there is no need to order them in any ocasion.



How do you solve this problem? What algorithm can you use to simply achieve the expected results in similar tasks? I recall that the solution that I do not want is the gradual testing and gradual addition, those are naive solutions, I'm looking for an effective algorithm using Chinese remainder theorem or Diophantine equation.



Thanks.










share|cite|improve this question




























    up vote
    0
    down vote

    favorite












    I needed an advise on implementing and solving one problem and the others like. I came across two sentences that I think will be helpful. Those are the Chinese remainder theorem and the Diofantic equation, but I do not know exactly how do I apply them to the problem.



    Let me introduce this problem f.e. on the sewer pipe, I will try to describe it as a verbal task:



    We need to design a sewer pipeline with an exact length of 127 m. We have tubes from 3 different suppliers. Each supplier produces tubes of different fixed lengths that can not be shortened or extended in any way:



    first supplier: 12 m



    second supplier: 8 m



    third supplier: 10 m



    At the beginning of the pipeline and at the end of the pipeline there must be bridging pipes having a length of 3 m. Between each and every tube must also be a bridging pipe.



    To illustrate this, we'll show the lengths as variables:



    (first supplier) X = 12 m



    (second supplier) Y = 8 m



    (third supplier) Z = 10 m



    (bridging pipe) A = 3 m



    Therefore, the scheme would be something like this:



    A Y A Y A Y A Y A Z A X A X A



    We ask how many tubes do we need to order from every supplier and how many solutions there are? Consider these solutions as a number of different admissible orders (one solution may look like f.e from the first sup. we'll order 5, from the second 3 and from the third 7). The bridging pipes are always sufficient and there is no need to order them in any ocasion.



    How do you solve this problem? What algorithm can you use to simply achieve the expected results in similar tasks? I recall that the solution that I do not want is the gradual testing and gradual addition, those are naive solutions, I'm looking for an effective algorithm using Chinese remainder theorem or Diophantine equation.



    Thanks.










    share|cite|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I needed an advise on implementing and solving one problem and the others like. I came across two sentences that I think will be helpful. Those are the Chinese remainder theorem and the Diofantic equation, but I do not know exactly how do I apply them to the problem.



      Let me introduce this problem f.e. on the sewer pipe, I will try to describe it as a verbal task:



      We need to design a sewer pipeline with an exact length of 127 m. We have tubes from 3 different suppliers. Each supplier produces tubes of different fixed lengths that can not be shortened or extended in any way:



      first supplier: 12 m



      second supplier: 8 m



      third supplier: 10 m



      At the beginning of the pipeline and at the end of the pipeline there must be bridging pipes having a length of 3 m. Between each and every tube must also be a bridging pipe.



      To illustrate this, we'll show the lengths as variables:



      (first supplier) X = 12 m



      (second supplier) Y = 8 m



      (third supplier) Z = 10 m



      (bridging pipe) A = 3 m



      Therefore, the scheme would be something like this:



      A Y A Y A Y A Y A Z A X A X A



      We ask how many tubes do we need to order from every supplier and how many solutions there are? Consider these solutions as a number of different admissible orders (one solution may look like f.e from the first sup. we'll order 5, from the second 3 and from the third 7). The bridging pipes are always sufficient and there is no need to order them in any ocasion.



      How do you solve this problem? What algorithm can you use to simply achieve the expected results in similar tasks? I recall that the solution that I do not want is the gradual testing and gradual addition, those are naive solutions, I'm looking for an effective algorithm using Chinese remainder theorem or Diophantine equation.



      Thanks.










      share|cite|improve this question















      I needed an advise on implementing and solving one problem and the others like. I came across two sentences that I think will be helpful. Those are the Chinese remainder theorem and the Diofantic equation, but I do not know exactly how do I apply them to the problem.



      Let me introduce this problem f.e. on the sewer pipe, I will try to describe it as a verbal task:



      We need to design a sewer pipeline with an exact length of 127 m. We have tubes from 3 different suppliers. Each supplier produces tubes of different fixed lengths that can not be shortened or extended in any way:



      first supplier: 12 m



      second supplier: 8 m



      third supplier: 10 m



      At the beginning of the pipeline and at the end of the pipeline there must be bridging pipes having a length of 3 m. Between each and every tube must also be a bridging pipe.



      To illustrate this, we'll show the lengths as variables:



      (first supplier) X = 12 m



      (second supplier) Y = 8 m



      (third supplier) Z = 10 m



      (bridging pipe) A = 3 m



      Therefore, the scheme would be something like this:



      A Y A Y A Y A Y A Z A X A X A



      We ask how many tubes do we need to order from every supplier and how many solutions there are? Consider these solutions as a number of different admissible orders (one solution may look like f.e from the first sup. we'll order 5, from the second 3 and from the third 7). The bridging pipes are always sufficient and there is no need to order them in any ocasion.



      How do you solve this problem? What algorithm can you use to simply achieve the expected results in similar tasks? I recall that the solution that I do not want is the gradual testing and gradual addition, those are naive solutions, I'm looking for an effective algorithm using Chinese remainder theorem or Diophantine equation.



      Thanks.







      algorithms diophantine-equations chinese-remainder-theorem






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 17 at 22:08









      Key Flex

      6,97431229




      6,97431229










      asked Nov 17 at 21:57









      jirick

      11




      11



























          active

          oldest

          votes











          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: 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%2f3002865%2fchinese-remainder-theorem-and-diophantine-equation-implementation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3002865%2fchinese-remainder-theorem-and-diophantine-equation-implementation%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

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei