Can someone explain this conclusion for Finite State Machines?

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











up vote
1
down vote

favorite












PS It isn't a homework problem..
(But the results seems to be working for me when I checked manually a couple of values of m and n)



Let's say I have two FSM's(calling them A and B)



  • A is the the machine for checking divisibility by any +ve number (calling it m)

  • B is the the machine for checking divisibility by any +ve number (calling it n)
    (m and n aren't equal)

Now we have a third machine (C) for which we need to find the number of states it will have if the goal of that machine is A machine(FSM) which will accept Divisibility of both $n$ and $m$)



So here are the claims for the count of states for $C$,



  • if $GCD (m,n)$ equivalent to $1$, then the number of states in C is $m*n$


  • if $GCD (m,n)$ isn't equivalent to $1$, then number of states in C is $LCM(m,n)$


(EDIT - Both are technically the same thing, check the comments and the answer)



Now I have checked the results for few m and m manually and they seem to be correct for them..



But why it's so?(I know that A and B will have m and n as count of states respectively for minimal DFA)










share|cite|improve this question



























    up vote
    1
    down vote

    favorite












    PS It isn't a homework problem..
    (But the results seems to be working for me when I checked manually a couple of values of m and n)



    Let's say I have two FSM's(calling them A and B)



    • A is the the machine for checking divisibility by any +ve number (calling it m)

    • B is the the machine for checking divisibility by any +ve number (calling it n)
      (m and n aren't equal)

    Now we have a third machine (C) for which we need to find the number of states it will have if the goal of that machine is A machine(FSM) which will accept Divisibility of both $n$ and $m$)



    So here are the claims for the count of states for $C$,



    • if $GCD (m,n)$ equivalent to $1$, then the number of states in C is $m*n$


    • if $GCD (m,n)$ isn't equivalent to $1$, then number of states in C is $LCM(m,n)$


    (EDIT - Both are technically the same thing, check the comments and the answer)



    Now I have checked the results for few m and m manually and they seem to be correct for them..



    But why it's so?(I know that A and B will have m and n as count of states respectively for minimal DFA)










    share|cite|improve this question

























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      PS It isn't a homework problem..
      (But the results seems to be working for me when I checked manually a couple of values of m and n)



      Let's say I have two FSM's(calling them A and B)



      • A is the the machine for checking divisibility by any +ve number (calling it m)

      • B is the the machine for checking divisibility by any +ve number (calling it n)
        (m and n aren't equal)

      Now we have a third machine (C) for which we need to find the number of states it will have if the goal of that machine is A machine(FSM) which will accept Divisibility of both $n$ and $m$)



      So here are the claims for the count of states for $C$,



      • if $GCD (m,n)$ equivalent to $1$, then the number of states in C is $m*n$


      • if $GCD (m,n)$ isn't equivalent to $1$, then number of states in C is $LCM(m,n)$


      (EDIT - Both are technically the same thing, check the comments and the answer)



      Now I have checked the results for few m and m manually and they seem to be correct for them..



      But why it's so?(I know that A and B will have m and n as count of states respectively for minimal DFA)










      share|cite|improve this question















      PS It isn't a homework problem..
      (But the results seems to be working for me when I checked manually a couple of values of m and n)



      Let's say I have two FSM's(calling them A and B)



      • A is the the machine for checking divisibility by any +ve number (calling it m)

      • B is the the machine for checking divisibility by any +ve number (calling it n)
        (m and n aren't equal)

      Now we have a third machine (C) for which we need to find the number of states it will have if the goal of that machine is A machine(FSM) which will accept Divisibility of both $n$ and $m$)



      So here are the claims for the count of states for $C$,



      • if $GCD (m,n)$ equivalent to $1$, then the number of states in C is $m*n$


      • if $GCD (m,n)$ isn't equivalent to $1$, then number of states in C is $LCM(m,n)$


      (EDIT - Both are technically the same thing, check the comments and the answer)



      Now I have checked the results for few m and m manually and they seem to be correct for them..



      But why it's so?(I know that A and B will have m and n as count of states respectively for minimal DFA)







      automata finite-automata






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited 12 mins ago

























      asked 42 mins ago









      Aditya

      14313




      14313




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          In both cases, the number of states is the LCM. This is because a number is divisible by $m$ and $n$ if, and only if, it is divisible by $mathrmlcm(m,n)$ and, for any positive integer $d$, you can check that the input length is divisible by $d$ by having states $0, dots, d-1$ such that the automaton is in state $i$ when the number of characters read is congruent to $i$, modulo $d$.






          share|cite|improve this answer




















          • Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
            – Aditya
            16 mins ago











          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: "419"
          ;
          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: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f99259%2fcan-someone-explain-this-conclusion-for-finite-state-machines%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          In both cases, the number of states is the LCM. This is because a number is divisible by $m$ and $n$ if, and only if, it is divisible by $mathrmlcm(m,n)$ and, for any positive integer $d$, you can check that the input length is divisible by $d$ by having states $0, dots, d-1$ such that the automaton is in state $i$ when the number of characters read is congruent to $i$, modulo $d$.






          share|cite|improve this answer




















          • Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
            – Aditya
            16 mins ago















          up vote
          2
          down vote



          accepted










          In both cases, the number of states is the LCM. This is because a number is divisible by $m$ and $n$ if, and only if, it is divisible by $mathrmlcm(m,n)$ and, for any positive integer $d$, you can check that the input length is divisible by $d$ by having states $0, dots, d-1$ such that the automaton is in state $i$ when the number of characters read is congruent to $i$, modulo $d$.






          share|cite|improve this answer




















          • Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
            – Aditya
            16 mins ago













          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          In both cases, the number of states is the LCM. This is because a number is divisible by $m$ and $n$ if, and only if, it is divisible by $mathrmlcm(m,n)$ and, for any positive integer $d$, you can check that the input length is divisible by $d$ by having states $0, dots, d-1$ such that the automaton is in state $i$ when the number of characters read is congruent to $i$, modulo $d$.






          share|cite|improve this answer












          In both cases, the number of states is the LCM. This is because a number is divisible by $m$ and $n$ if, and only if, it is divisible by $mathrmlcm(m,n)$ and, for any positive integer $d$, you can check that the input length is divisible by $d$ by having states $0, dots, d-1$ such that the automaton is in state $i$ when the number of characters read is congruent to $i$, modulo $d$.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered 20 mins ago









          David Richerby

          63.3k1596181




          63.3k1596181











          • Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
            – Aditya
            16 mins ago

















          • Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
            – Aditya
            16 mins ago
















          Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
          – Aditya
          16 mins ago





          Thanks a lot David! I forgot this simple but strong conclusion of LCM's and Divisibility!
          – Aditya
          16 mins ago


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f99259%2fcan-someone-explain-this-conclusion-for-finite-state-machines%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          List of Gilmore Girls characters

          Confectionery