Count specific semi-consequtive subsets of a set - general formula?











up vote
0
down vote

favorite












Given a set of consequtive integer numbers {1,2,3,...36} and considering all 376992 5-number combinations out of this set, how can we count following:



number of 5-number combinations having 3 numbers like this




  1. +1, +2 pattern: (1,2,4) or (2,3,5) or ... or (33,34,36)

  2. +2, +2 pattern

  3. +2, +3 pattern


  4. +n, +k pattern



    Is it possible to generalize?












share|cite|improve this question




























    up vote
    0
    down vote

    favorite












    Given a set of consequtive integer numbers {1,2,3,...36} and considering all 376992 5-number combinations out of this set, how can we count following:



    number of 5-number combinations having 3 numbers like this




    1. +1, +2 pattern: (1,2,4) or (2,3,5) or ... or (33,34,36)

    2. +2, +2 pattern

    3. +2, +3 pattern


    4. +n, +k pattern



      Is it possible to generalize?












    share|cite|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Given a set of consequtive integer numbers {1,2,3,...36} and considering all 376992 5-number combinations out of this set, how can we count following:



      number of 5-number combinations having 3 numbers like this




      1. +1, +2 pattern: (1,2,4) or (2,3,5) or ... or (33,34,36)

      2. +2, +2 pattern

      3. +2, +3 pattern


      4. +n, +k pattern



        Is it possible to generalize?












      share|cite|improve this question















      Given a set of consequtive integer numbers {1,2,3,...36} and considering all 376992 5-number combinations out of this set, how can we count following:



      number of 5-number combinations having 3 numbers like this




      1. +1, +2 pattern: (1,2,4) or (2,3,5) or ... or (33,34,36)

      2. +2, +2 pattern

      3. +2, +3 pattern


      4. +n, +k pattern



        Is it possible to generalize?









      combinatorics combinations






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Nov 13 at 22:37









      Asaf Karagila

      299k32420750




      299k32420750










      asked Nov 13 at 22:33









      caasdads

      947




      947






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          If I understand correctly, you want to get all the subsets of 5 elements where you have 3 numbers following the pattern.
          The number of ways to get 3 numbers that follow the pattern is equal to: $$36 - n - k$$ This means that you need to figure out what is the highest value that you can pick in such a way that the second and third numbers are still in the initial set.
          From the remaining numbers, you need to pick 2, in order to form a set of 5 elements, and this can be done in: $$binom{33}{2}$$
          So the total number of sets that follow the rule is:
          $$(36 - n - k) binom{33}{2}$$



          This assumes that when you have a pattern like: +2, +4, having {1,2,3,4,5} is still a valid set because {1,3,5} follow the pattern.






          share|cite|improve this answer























          • This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
            – Code Complete
            Nov 13 at 23:04






          • 1




            I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
            – Erik Cristian Seulean
            Nov 13 at 23:14












          • The formula holds only for n=1, k=1.
            – Code Complete
            Nov 13 at 23:37






          • 1




            I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
            – Erik Cristian Seulean
            Nov 13 at 23:55













          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%2f2997443%2fcount-specific-semi-consequtive-subsets-of-a-set-general-formula%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          If I understand correctly, you want to get all the subsets of 5 elements where you have 3 numbers following the pattern.
          The number of ways to get 3 numbers that follow the pattern is equal to: $$36 - n - k$$ This means that you need to figure out what is the highest value that you can pick in such a way that the second and third numbers are still in the initial set.
          From the remaining numbers, you need to pick 2, in order to form a set of 5 elements, and this can be done in: $$binom{33}{2}$$
          So the total number of sets that follow the rule is:
          $$(36 - n - k) binom{33}{2}$$



          This assumes that when you have a pattern like: +2, +4, having {1,2,3,4,5} is still a valid set because {1,3,5} follow the pattern.






          share|cite|improve this answer























          • This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
            – Code Complete
            Nov 13 at 23:04






          • 1




            I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
            – Erik Cristian Seulean
            Nov 13 at 23:14












          • The formula holds only for n=1, k=1.
            – Code Complete
            Nov 13 at 23:37






          • 1




            I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
            – Erik Cristian Seulean
            Nov 13 at 23:55

















          up vote
          1
          down vote













          If I understand correctly, you want to get all the subsets of 5 elements where you have 3 numbers following the pattern.
          The number of ways to get 3 numbers that follow the pattern is equal to: $$36 - n - k$$ This means that you need to figure out what is the highest value that you can pick in such a way that the second and third numbers are still in the initial set.
          From the remaining numbers, you need to pick 2, in order to form a set of 5 elements, and this can be done in: $$binom{33}{2}$$
          So the total number of sets that follow the rule is:
          $$(36 - n - k) binom{33}{2}$$



          This assumes that when you have a pattern like: +2, +4, having {1,2,3,4,5} is still a valid set because {1,3,5} follow the pattern.






          share|cite|improve this answer























          • This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
            – Code Complete
            Nov 13 at 23:04






          • 1




            I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
            – Erik Cristian Seulean
            Nov 13 at 23:14












          • The formula holds only for n=1, k=1.
            – Code Complete
            Nov 13 at 23:37






          • 1




            I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
            – Erik Cristian Seulean
            Nov 13 at 23:55















          up vote
          1
          down vote










          up vote
          1
          down vote









          If I understand correctly, you want to get all the subsets of 5 elements where you have 3 numbers following the pattern.
          The number of ways to get 3 numbers that follow the pattern is equal to: $$36 - n - k$$ This means that you need to figure out what is the highest value that you can pick in such a way that the second and third numbers are still in the initial set.
          From the remaining numbers, you need to pick 2, in order to form a set of 5 elements, and this can be done in: $$binom{33}{2}$$
          So the total number of sets that follow the rule is:
          $$(36 - n - k) binom{33}{2}$$



          This assumes that when you have a pattern like: +2, +4, having {1,2,3,4,5} is still a valid set because {1,3,5} follow the pattern.






          share|cite|improve this answer














          If I understand correctly, you want to get all the subsets of 5 elements where you have 3 numbers following the pattern.
          The number of ways to get 3 numbers that follow the pattern is equal to: $$36 - n - k$$ This means that you need to figure out what is the highest value that you can pick in such a way that the second and third numbers are still in the initial set.
          From the remaining numbers, you need to pick 2, in order to form a set of 5 elements, and this can be done in: $$binom{33}{2}$$
          So the total number of sets that follow the rule is:
          $$(36 - n - k) binom{33}{2}$$



          This assumes that when you have a pattern like: +2, +4, having {1,2,3,4,5} is still a valid set because {1,3,5} follow the pattern.







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Nov 13 at 23:57

























          answered Nov 13 at 22:40









          Erik Cristian Seulean

          385




          385












          • This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
            – Code Complete
            Nov 13 at 23:04






          • 1




            I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
            – Erik Cristian Seulean
            Nov 13 at 23:14












          • The formula holds only for n=1, k=1.
            – Code Complete
            Nov 13 at 23:37






          • 1




            I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
            – Erik Cristian Seulean
            Nov 13 at 23:55




















          • This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
            – Code Complete
            Nov 13 at 23:04






          • 1




            I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
            – Erik Cristian Seulean
            Nov 13 at 23:14












          • The formula holds only for n=1, k=1.
            – Code Complete
            Nov 13 at 23:37






          • 1




            I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
            – Erik Cristian Seulean
            Nov 13 at 23:55


















          This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
          – Code Complete
          Nov 13 at 23:04




          This is a great idea! Unfortunately I need +n +k pattern like this: +2, +4 pattern is {1,3,7} that is +2 is applied to smallest element, and +4 applies to the result of first +2, not to smallest element itself (1). So {1,3,5} is +2 +2 pattern, not +2 +4. Otherwise, there are no restrictions on the other (two) numbers which are not part of such 3-number-set-following-pattern.
          – Code Complete
          Nov 13 at 23:04




          1




          1




          I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
          – Erik Cristian Seulean
          Nov 13 at 23:14






          I think 36 - n - k is still valid. x + n = p; p + k <= 36. In this case x + n + p <= 36. There are 36 - n - p ways to choose x.
          – Erik Cristian Seulean
          Nov 13 at 23:14














          The formula holds only for n=1, k=1.
          – Code Complete
          Nov 13 at 23:37




          The formula holds only for n=1, k=1.
          – Code Complete
          Nov 13 at 23:37




          1




          1




          I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
          – Erik Cristian Seulean
          Nov 13 at 23:55






          I don't think I follow correctly what you actually want. For n=1;k=20 you have 36 - 21 = 15 options for the first number. (Everything from {1,2, ..., 15}). Last set is going to be {15,16,36} plus all the remaining combinations of 2 numbers out of 33. This gives 9450 possible combinations. What am I missing here ?
          – Erik Cristian Seulean
          Nov 13 at 23:55




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2997443%2fcount-specific-semi-consequtive-subsets-of-a-set-general-formula%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

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?