Partitioning a set of integers

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











up vote
3
down vote

favorite












I have a set of ordered integers, e.g. 1,2,3,6,7,9,10 and I would like to partition the set in subsets of sequential numbers, e.g. 1,2,3,6,7,9,10. Is there an easy way to do this?










share|improve this question



























    up vote
    3
    down vote

    favorite












    I have a set of ordered integers, e.g. 1,2,3,6,7,9,10 and I would like to partition the set in subsets of sequential numbers, e.g. 1,2,3,6,7,9,10. Is there an easy way to do this?










    share|improve this question

























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I have a set of ordered integers, e.g. 1,2,3,6,7,9,10 and I would like to partition the set in subsets of sequential numbers, e.g. 1,2,3,6,7,9,10. Is there an easy way to do this?










      share|improve this question















      I have a set of ordered integers, e.g. 1,2,3,6,7,9,10 and I would like to partition the set in subsets of sequential numbers, e.g. 1,2,3,6,7,9,10. Is there an easy way to do this?







      partitions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 hours ago









      That Gravity Guy

      1,898514




      1,898514










      asked 3 hours ago









      user26718

      661




      661




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote













          Split[1, 2, 3, 6, 7, 9, 10, #2 - #1 == 1 &] 



          1, 2, 3, 6, 7, 9, 10







          share|improve this answer






















          • How come you're using Chop here? It works fine without it.
            – Carl Lange
            3 hours 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: "387"
          ;
          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: "",
          imageUploader:
          brandingHtml: "",
          contentPolicyHtml: "",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184969%2fpartitioning-a-set-of-integers%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
          4
          down vote













          Split[1, 2, 3, 6, 7, 9, 10, #2 - #1 == 1 &] 



          1, 2, 3, 6, 7, 9, 10







          share|improve this answer






















          • How come you're using Chop here? It works fine without it.
            – Carl Lange
            3 hours ago














          up vote
          4
          down vote













          Split[1, 2, 3, 6, 7, 9, 10, #2 - #1 == 1 &] 



          1, 2, 3, 6, 7, 9, 10







          share|improve this answer






















          • How come you're using Chop here? It works fine without it.
            – Carl Lange
            3 hours ago












          up vote
          4
          down vote










          up vote
          4
          down vote









          Split[1, 2, 3, 6, 7, 9, 10, #2 - #1 == 1 &] 



          1, 2, 3, 6, 7, 9, 10







          share|improve this answer














          Split[1, 2, 3, 6, 7, 9, 10, #2 - #1 == 1 &] 



          1, 2, 3, 6, 7, 9, 10








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 3 hours ago

























          answered 3 hours ago









          J42161217

          1,984217




          1,984217











          • How come you're using Chop here? It works fine without it.
            – Carl Lange
            3 hours ago
















          • How come you're using Chop here? It works fine without it.
            – Carl Lange
            3 hours ago















          How come you're using Chop here? It works fine without it.
          – Carl Lange
          3 hours ago




          How come you're using Chop here? It works fine without it.
          – Carl Lange
          3 hours ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184969%2fpartitioning-a-set-of-integers%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery