Finding the number of combinations that fit certain criteria












-1












$begingroup$


Assuming that the letters A, B and C are used to generate all possible "strings" of length seventeen (17) characters (like ACBBCABCACBCABCCB), how many of these strings have exactly four (4) B's? How can we go about this?



Context: I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.










share|cite|improve this question











$endgroup$












  • $begingroup$
    Is this a homework problem? Further context would be appreciated.
    $endgroup$
    – Zachary Hunter
    Jan 1 at 19:09










  • $begingroup$
    No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
    $endgroup$
    – Muga S.
    Jan 1 at 20:24








  • 2




    $begingroup$
    There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
    $endgroup$
    – N. F. Taussig
    Jan 1 at 21:21










  • $begingroup$
    So, going by your theory, there are 2^13 strings with 4 B's, am I right?
    $endgroup$
    – Muga S.
    Jan 1 at 21:23










  • $begingroup$
    Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
    $endgroup$
    – Muga S.
    Jan 1 at 22:03
















-1












$begingroup$


Assuming that the letters A, B and C are used to generate all possible "strings" of length seventeen (17) characters (like ACBBCABCACBCABCCB), how many of these strings have exactly four (4) B's? How can we go about this?



Context: I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.










share|cite|improve this question











$endgroup$












  • $begingroup$
    Is this a homework problem? Further context would be appreciated.
    $endgroup$
    – Zachary Hunter
    Jan 1 at 19:09










  • $begingroup$
    No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
    $endgroup$
    – Muga S.
    Jan 1 at 20:24








  • 2




    $begingroup$
    There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
    $endgroup$
    – N. F. Taussig
    Jan 1 at 21:21










  • $begingroup$
    So, going by your theory, there are 2^13 strings with 4 B's, am I right?
    $endgroup$
    – Muga S.
    Jan 1 at 21:23










  • $begingroup$
    Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
    $endgroup$
    – Muga S.
    Jan 1 at 22:03














-1












-1








-1





$begingroup$


Assuming that the letters A, B and C are used to generate all possible "strings" of length seventeen (17) characters (like ACBBCABCACBCABCCB), how many of these strings have exactly four (4) B's? How can we go about this?



Context: I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.










share|cite|improve this question











$endgroup$




Assuming that the letters A, B and C are used to generate all possible "strings" of length seventeen (17) characters (like ACBBCABCACBCABCCB), how many of these strings have exactly four (4) B's? How can we go about this?



Context: I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.







combinatorics permutations






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 1 at 21:19









N. F. Taussig

43.7k93355




43.7k93355










asked Jan 1 at 19:05









Muga S.Muga S.

1




1












  • $begingroup$
    Is this a homework problem? Further context would be appreciated.
    $endgroup$
    – Zachary Hunter
    Jan 1 at 19:09










  • $begingroup$
    No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
    $endgroup$
    – Muga S.
    Jan 1 at 20:24








  • 2




    $begingroup$
    There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
    $endgroup$
    – N. F. Taussig
    Jan 1 at 21:21










  • $begingroup$
    So, going by your theory, there are 2^13 strings with 4 B's, am I right?
    $endgroup$
    – Muga S.
    Jan 1 at 21:23










  • $begingroup$
    Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
    $endgroup$
    – Muga S.
    Jan 1 at 22:03


















  • $begingroup$
    Is this a homework problem? Further context would be appreciated.
    $endgroup$
    – Zachary Hunter
    Jan 1 at 19:09










  • $begingroup$
    No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
    $endgroup$
    – Muga S.
    Jan 1 at 20:24








  • 2




    $begingroup$
    There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
    $endgroup$
    – N. F. Taussig
    Jan 1 at 21:21










  • $begingroup$
    So, going by your theory, there are 2^13 strings with 4 B's, am I right?
    $endgroup$
    – Muga S.
    Jan 1 at 21:23










  • $begingroup$
    Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
    $endgroup$
    – Muga S.
    Jan 1 at 22:03
















$begingroup$
Is this a homework problem? Further context would be appreciated.
$endgroup$
– Zachary Hunter
Jan 1 at 19:09




$begingroup$
Is this a homework problem? Further context would be appreciated.
$endgroup$
– Zachary Hunter
Jan 1 at 19:09












$begingroup$
No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
$endgroup$
– Muga S.
Jan 1 at 20:24






$begingroup$
No, not a homework problem. I recently came across a piece of software that generates all possible combinations from a given character set. I used it to generate all the possible strings that are 17-character long with the character set A, B, C. A total of over 129 million combinations were generated, the resulting text file being over 2GB! It would be infeasible to go through all of those combinations by hand to find all the strings that have 4 B's. As such, I am looking for a way to solve that problem mathematically.
$endgroup$
– Muga S.
Jan 1 at 20:24






2




2




$begingroup$
There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
$endgroup$
– N. F. Taussig
Jan 1 at 21:21




$begingroup$
There are $3^{17}$ strings of length $17$ that can be formed using the alphabet ${A, B, C}$ since there are three choices for each position. In your problem, you must choose four positions for the $B$s. You are then left with two choices for each of the remaining $13$ positions.
$endgroup$
– N. F. Taussig
Jan 1 at 21:21












$begingroup$
So, going by your theory, there are 2^13 strings with 4 B's, am I right?
$endgroup$
– Muga S.
Jan 1 at 21:23




$begingroup$
So, going by your theory, there are 2^13 strings with 4 B's, am I right?
$endgroup$
– Muga S.
Jan 1 at 21:23












$begingroup$
Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
$endgroup$
– Muga S.
Jan 1 at 22:03




$begingroup$
Instead of generating strings of length 17 characters, I toned it down to 8 characters just to have a fewer number of possible combinations to work with. Still using the character set A, B, C, that's a total of 3^8 = 6,561 total combinations. How many of these combinations have 4 B's? Well, 2^4, right? Turns out, no. I generated all those 6,561 strings, pasted them to Microsoft Excel and asked it to count the number of B's in all the strings. Then I just copied the ones with 4 B's to a new Excel worksheet. I get 1,120 strings with 4 B's but not 2^4. What gives?
$endgroup$
– Muga S.
Jan 1 at 22:03










1 Answer
1






active

oldest

votes


















0












$begingroup$

First pick the places for the $B$'s, which you can do in ${17 choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you. That works. Appreciated.
    $endgroup$
    – Muga S.
    Jan 2 at 0:27











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',
autoActivateHeartbeat: false,
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%2f3058774%2ffinding-the-number-of-combinations-that-fit-certain-criteria%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









0












$begingroup$

First pick the places for the $B$'s, which you can do in ${17 choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you. That works. Appreciated.
    $endgroup$
    – Muga S.
    Jan 2 at 0:27
















0












$begingroup$

First pick the places for the $B$'s, which you can do in ${17 choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Thank you. That works. Appreciated.
    $endgroup$
    – Muga S.
    Jan 2 at 0:27














0












0








0





$begingroup$

First pick the places for the $B$'s, which you can do in ${17 choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.






share|cite|improve this answer









$endgroup$



First pick the places for the $B$'s, which you can do in ${17 choose 4}=2380$ ways. Then each of the other places has two choices, so that gives a factor $2^{13}=8192$. Multiply them.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Jan 1 at 23:17









Ross MillikanRoss Millikan

293k23197371




293k23197371












  • $begingroup$
    Thank you. That works. Appreciated.
    $endgroup$
    – Muga S.
    Jan 2 at 0:27


















  • $begingroup$
    Thank you. That works. Appreciated.
    $endgroup$
    – Muga S.
    Jan 2 at 0:27
















$begingroup$
Thank you. That works. Appreciated.
$endgroup$
– Muga S.
Jan 2 at 0:27




$begingroup$
Thank you. That works. Appreciated.
$endgroup$
– Muga S.
Jan 2 at 0:27


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3058774%2ffinding-the-number-of-combinations-that-fit-certain-criteria%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

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory