A strange computer programming language












5














Here is a list of rational numbers:



$frac{22}{21}, frac{7}{11}, frac{13}{7}, frac{51}{65}, frac{13}{17}, frac{1}{13}, frac{15}{2}, frac{7}{1}$



This list is actually a computer program! It takes an integer as its input, and outputs a sequence of integers. The way it executes is as follows:



Find the first fraction on the list that, when multiplied to the input, produces an integer. That integer is output. The process is then repeated using that integer as the new input.



For example, if the program is run with input $2$, then the output will be the sequence $15, 105, 110, 70, 130, ...$.




When given $2$ as its input, what does this program do?

More specifically, when it produces an integer of the form $2^a 3^b$, what can you say about $a$ and $b$?




 



Source:

This puzzle is mostly an excuse to show this esoteric, Turing-complete programming language that few people have heard of. I wrote the simple program used in this puzzle myself. The programming language is called FRACTRAN, and it was invented by John Horton Conway.










share|improve this question





























    5














    Here is a list of rational numbers:



    $frac{22}{21}, frac{7}{11}, frac{13}{7}, frac{51}{65}, frac{13}{17}, frac{1}{13}, frac{15}{2}, frac{7}{1}$



    This list is actually a computer program! It takes an integer as its input, and outputs a sequence of integers. The way it executes is as follows:



    Find the first fraction on the list that, when multiplied to the input, produces an integer. That integer is output. The process is then repeated using that integer as the new input.



    For example, if the program is run with input $2$, then the output will be the sequence $15, 105, 110, 70, 130, ...$.




    When given $2$ as its input, what does this program do?

    More specifically, when it produces an integer of the form $2^a 3^b$, what can you say about $a$ and $b$?




     



    Source:

    This puzzle is mostly an excuse to show this esoteric, Turing-complete programming language that few people have heard of. I wrote the simple program used in this puzzle myself. The programming language is called FRACTRAN, and it was invented by John Horton Conway.










    share|improve this question



























      5












      5








      5







      Here is a list of rational numbers:



      $frac{22}{21}, frac{7}{11}, frac{13}{7}, frac{51}{65}, frac{13}{17}, frac{1}{13}, frac{15}{2}, frac{7}{1}$



      This list is actually a computer program! It takes an integer as its input, and outputs a sequence of integers. The way it executes is as follows:



      Find the first fraction on the list that, when multiplied to the input, produces an integer. That integer is output. The process is then repeated using that integer as the new input.



      For example, if the program is run with input $2$, then the output will be the sequence $15, 105, 110, 70, 130, ...$.




      When given $2$ as its input, what does this program do?

      More specifically, when it produces an integer of the form $2^a 3^b$, what can you say about $a$ and $b$?




       



      Source:

      This puzzle is mostly an excuse to show this esoteric, Turing-complete programming language that few people have heard of. I wrote the simple program used in this puzzle myself. The programming language is called FRACTRAN, and it was invented by John Horton Conway.










      share|improve this question















      Here is a list of rational numbers:



      $frac{22}{21}, frac{7}{11}, frac{13}{7}, frac{51}{65}, frac{13}{17}, frac{1}{13}, frac{15}{2}, frac{7}{1}$



      This list is actually a computer program! It takes an integer as its input, and outputs a sequence of integers. The way it executes is as follows:



      Find the first fraction on the list that, when multiplied to the input, produces an integer. That integer is output. The process is then repeated using that integer as the new input.



      For example, if the program is run with input $2$, then the output will be the sequence $15, 105, 110, 70, 130, ...$.




      When given $2$ as its input, what does this program do?

      More specifically, when it produces an integer of the form $2^a 3^b$, what can you say about $a$ and $b$?




       



      Source:

      This puzzle is mostly an excuse to show this esoteric, Turing-complete programming language that few people have heard of. I wrote the simple program used in this puzzle myself. The programming language is called FRACTRAN, and it was invented by John Horton Conway.







      mathematics computer-science






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 17 mins ago

























      asked 2 hours ago









      Jaap Scherphuis

      14.5k12563




      14.5k12563






















          2 Answers
          2






          active

          oldest

          votes


















          2














          First, let's change our interpretation of the rational numbers as




          Translating some (power of) prime factors from the input to another (power of) prime factors:

          $[1]~3,7 rightarrow 2,11$
          $[2]~11 rightarrow 7$
          $[3]~7 rightarrow 13$
          $[4]~5,13 rightarrow 3,17$
          $[5]~17 rightarrow 13$
          $[6]~13 rightarrow .$
          $[7]~2 rightarrow 3,5$
          $[8]~. rightarrow 7$




          As you may see, if we start with $2^a3^b$




          We will always go to $[7]$, translating all $2$ to $3$ and $5$, until there is no $2$ left and we will get $3^{a+b}5^a$.




          Next




          We will go to $[8]$ to receive a "token" of $7$.




          What's so special about it?




          It can be used for $[1]-[3]$.

          $[1]$ require the token and a prime factor $3$, generate $2$ and new token $11$.

          On $[2]$ the new token will be replaced to original token $7$, so it will go back to $[1]$ until...

          There is no $3$ left, and we will go to $[3]$, replace the token to another token of $13$.




          Here, we will get




          $2^{a+b}5^{a}13$, the $3$ were all translated to $2$.




          The next part is actually




          The same. $[4]-[6]$ is similar with $[1]-[3]$ except it translated $5$ to $3$, and the token will be dissapeared.




          Leaving the "final" number




          $2^{a+b}3^a$




          Hence




          If we let $a$ being the power of $2$ and $b$ being the power of $3$, we will transform $(a,b)$ to $(a+b,a)$. The first number will go to second one, and the sum of them will go to the first one.

          This is actually a Fibonacci series with given $(F_n,F_{n-1})$ which will be translated to $(F_{n+1},F_n)$







          share|improve this answer































            0














            It looks like the program calculates




            the Fibonacci sequence.




            Specifically, the $n$-th time the output sequence is of the form $2^a3^b$,




            $a = F_{n+1}$, $b = F_n$




            (the input, 2, counts as $n=0$)



            The first few outputs are:




            2, 15, 105, 110, 70, 130, 102, 78, 6, 45, 315, 330, 210, 220, 140, 260, 204, 156, 12, ..., 72 (33th output), ..., 864 (55th output), ...




            How it does this is a mystery to me ...






            share|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: "559"
              };
              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: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              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%2fpuzzling.stackexchange.com%2fquestions%2f77882%2fa-strange-computer-programming-language%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









              2














              First, let's change our interpretation of the rational numbers as




              Translating some (power of) prime factors from the input to another (power of) prime factors:

              $[1]~3,7 rightarrow 2,11$
              $[2]~11 rightarrow 7$
              $[3]~7 rightarrow 13$
              $[4]~5,13 rightarrow 3,17$
              $[5]~17 rightarrow 13$
              $[6]~13 rightarrow .$
              $[7]~2 rightarrow 3,5$
              $[8]~. rightarrow 7$




              As you may see, if we start with $2^a3^b$




              We will always go to $[7]$, translating all $2$ to $3$ and $5$, until there is no $2$ left and we will get $3^{a+b}5^a$.




              Next




              We will go to $[8]$ to receive a "token" of $7$.




              What's so special about it?




              It can be used for $[1]-[3]$.

              $[1]$ require the token and a prime factor $3$, generate $2$ and new token $11$.

              On $[2]$ the new token will be replaced to original token $7$, so it will go back to $[1]$ until...

              There is no $3$ left, and we will go to $[3]$, replace the token to another token of $13$.




              Here, we will get




              $2^{a+b}5^{a}13$, the $3$ were all translated to $2$.




              The next part is actually




              The same. $[4]-[6]$ is similar with $[1]-[3]$ except it translated $5$ to $3$, and the token will be dissapeared.




              Leaving the "final" number




              $2^{a+b}3^a$




              Hence




              If we let $a$ being the power of $2$ and $b$ being the power of $3$, we will transform $(a,b)$ to $(a+b,a)$. The first number will go to second one, and the sum of them will go to the first one.

              This is actually a Fibonacci series with given $(F_n,F_{n-1})$ which will be translated to $(F_{n+1},F_n)$







              share|improve this answer




























                2














                First, let's change our interpretation of the rational numbers as




                Translating some (power of) prime factors from the input to another (power of) prime factors:

                $[1]~3,7 rightarrow 2,11$
                $[2]~11 rightarrow 7$
                $[3]~7 rightarrow 13$
                $[4]~5,13 rightarrow 3,17$
                $[5]~17 rightarrow 13$
                $[6]~13 rightarrow .$
                $[7]~2 rightarrow 3,5$
                $[8]~. rightarrow 7$




                As you may see, if we start with $2^a3^b$




                We will always go to $[7]$, translating all $2$ to $3$ and $5$, until there is no $2$ left and we will get $3^{a+b}5^a$.




                Next




                We will go to $[8]$ to receive a "token" of $7$.




                What's so special about it?




                It can be used for $[1]-[3]$.

                $[1]$ require the token and a prime factor $3$, generate $2$ and new token $11$.

                On $[2]$ the new token will be replaced to original token $7$, so it will go back to $[1]$ until...

                There is no $3$ left, and we will go to $[3]$, replace the token to another token of $13$.




                Here, we will get




                $2^{a+b}5^{a}13$, the $3$ were all translated to $2$.




                The next part is actually




                The same. $[4]-[6]$ is similar with $[1]-[3]$ except it translated $5$ to $3$, and the token will be dissapeared.




                Leaving the "final" number




                $2^{a+b}3^a$




                Hence




                If we let $a$ being the power of $2$ and $b$ being the power of $3$, we will transform $(a,b)$ to $(a+b,a)$. The first number will go to second one, and the sum of them will go to the first one.

                This is actually a Fibonacci series with given $(F_n,F_{n-1})$ which will be translated to $(F_{n+1},F_n)$







                share|improve this answer


























                  2












                  2








                  2






                  First, let's change our interpretation of the rational numbers as




                  Translating some (power of) prime factors from the input to another (power of) prime factors:

                  $[1]~3,7 rightarrow 2,11$
                  $[2]~11 rightarrow 7$
                  $[3]~7 rightarrow 13$
                  $[4]~5,13 rightarrow 3,17$
                  $[5]~17 rightarrow 13$
                  $[6]~13 rightarrow .$
                  $[7]~2 rightarrow 3,5$
                  $[8]~. rightarrow 7$




                  As you may see, if we start with $2^a3^b$




                  We will always go to $[7]$, translating all $2$ to $3$ and $5$, until there is no $2$ left and we will get $3^{a+b}5^a$.




                  Next




                  We will go to $[8]$ to receive a "token" of $7$.




                  What's so special about it?




                  It can be used for $[1]-[3]$.

                  $[1]$ require the token and a prime factor $3$, generate $2$ and new token $11$.

                  On $[2]$ the new token will be replaced to original token $7$, so it will go back to $[1]$ until...

                  There is no $3$ left, and we will go to $[3]$, replace the token to another token of $13$.




                  Here, we will get




                  $2^{a+b}5^{a}13$, the $3$ were all translated to $2$.




                  The next part is actually




                  The same. $[4]-[6]$ is similar with $[1]-[3]$ except it translated $5$ to $3$, and the token will be dissapeared.




                  Leaving the "final" number




                  $2^{a+b}3^a$




                  Hence




                  If we let $a$ being the power of $2$ and $b$ being the power of $3$, we will transform $(a,b)$ to $(a+b,a)$. The first number will go to second one, and the sum of them will go to the first one.

                  This is actually a Fibonacci series with given $(F_n,F_{n-1})$ which will be translated to $(F_{n+1},F_n)$







                  share|improve this answer














                  First, let's change our interpretation of the rational numbers as




                  Translating some (power of) prime factors from the input to another (power of) prime factors:

                  $[1]~3,7 rightarrow 2,11$
                  $[2]~11 rightarrow 7$
                  $[3]~7 rightarrow 13$
                  $[4]~5,13 rightarrow 3,17$
                  $[5]~17 rightarrow 13$
                  $[6]~13 rightarrow .$
                  $[7]~2 rightarrow 3,5$
                  $[8]~. rightarrow 7$




                  As you may see, if we start with $2^a3^b$




                  We will always go to $[7]$, translating all $2$ to $3$ and $5$, until there is no $2$ left and we will get $3^{a+b}5^a$.




                  Next




                  We will go to $[8]$ to receive a "token" of $7$.




                  What's so special about it?




                  It can be used for $[1]-[3]$.

                  $[1]$ require the token and a prime factor $3$, generate $2$ and new token $11$.

                  On $[2]$ the new token will be replaced to original token $7$, so it will go back to $[1]$ until...

                  There is no $3$ left, and we will go to $[3]$, replace the token to another token of $13$.




                  Here, we will get




                  $2^{a+b}5^{a}13$, the $3$ were all translated to $2$.




                  The next part is actually




                  The same. $[4]-[6]$ is similar with $[1]-[3]$ except it translated $5$ to $3$, and the token will be dissapeared.




                  Leaving the "final" number




                  $2^{a+b}3^a$




                  Hence




                  If we let $a$ being the power of $2$ and $b$ being the power of $3$, we will transform $(a,b)$ to $(a+b,a)$. The first number will go to second one, and the sum of them will go to the first one.

                  This is actually a Fibonacci series with given $(F_n,F_{n-1})$ which will be translated to $(F_{n+1},F_n)$








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 4 mins ago









                  Jaap Scherphuis

                  14.5k12563




                  14.5k12563










                  answered 30 mins ago









                  athin

                  6,98912366




                  6,98912366























                      0














                      It looks like the program calculates




                      the Fibonacci sequence.




                      Specifically, the $n$-th time the output sequence is of the form $2^a3^b$,




                      $a = F_{n+1}$, $b = F_n$




                      (the input, 2, counts as $n=0$)



                      The first few outputs are:




                      2, 15, 105, 110, 70, 130, 102, 78, 6, 45, 315, 330, 210, 220, 140, 260, 204, 156, 12, ..., 72 (33th output), ..., 864 (55th output), ...




                      How it does this is a mystery to me ...






                      share|improve this answer




























                        0














                        It looks like the program calculates




                        the Fibonacci sequence.




                        Specifically, the $n$-th time the output sequence is of the form $2^a3^b$,




                        $a = F_{n+1}$, $b = F_n$




                        (the input, 2, counts as $n=0$)



                        The first few outputs are:




                        2, 15, 105, 110, 70, 130, 102, 78, 6, 45, 315, 330, 210, 220, 140, 260, 204, 156, 12, ..., 72 (33th output), ..., 864 (55th output), ...




                        How it does this is a mystery to me ...






                        share|improve this answer


























                          0












                          0








                          0






                          It looks like the program calculates




                          the Fibonacci sequence.




                          Specifically, the $n$-th time the output sequence is of the form $2^a3^b$,




                          $a = F_{n+1}$, $b = F_n$




                          (the input, 2, counts as $n=0$)



                          The first few outputs are:




                          2, 15, 105, 110, 70, 130, 102, 78, 6, 45, 315, 330, 210, 220, 140, 260, 204, 156, 12, ..., 72 (33th output), ..., 864 (55th output), ...




                          How it does this is a mystery to me ...






                          share|improve this answer














                          It looks like the program calculates




                          the Fibonacci sequence.




                          Specifically, the $n$-th time the output sequence is of the form $2^a3^b$,




                          $a = F_{n+1}$, $b = F_n$




                          (the input, 2, counts as $n=0$)



                          The first few outputs are:




                          2, 15, 105, 110, 70, 130, 102, 78, 6, 45, 315, 330, 210, 220, 140, 260, 204, 156, 12, ..., 72 (33th output), ..., 864 (55th output), ...




                          How it does this is a mystery to me ...







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 34 mins ago

























                          answered 48 mins ago









                          Glorfindel

                          13.1k34881




                          13.1k34881






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Puzzling 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%2fpuzzling.stackexchange.com%2fquestions%2f77882%2fa-strange-computer-programming-language%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

                              Accessing regular linux commands in Huawei's Dopra Linux

                              Can't connect RFCOMM socket: Host is down

                              Kernel panic - not syncing: Fatal Exception in Interrupt