Counting the number of strings starting with “t” and containing 2 vowels and 2 consonantsCounting the...
What stops you from using fixed income in developing countries?
Defending Castle from Zombies
Commercial company wants me to list all prior "inventions", give up everything not listed
What to do about my 1-month-old boy peeing through diapers?
Why did Lucius make a deal out of Buckbeak hurting Draco but not about Draco being turned into a ferret?
Find feasible point in polynomial time in linear programming
Count the number of triangles
Book featuring a child learning from a crowdsourced AI book
Force SQL Server to use fragmented indexes?
Unlock your Lock
Notice period 60 days but I need to join in 45 days
Videos of surgery
Was a star-crossed lover
Federal Pacific 200a main panel problem with oversized 100a 2pole breaker
Dotted background on a flowchart
Biological refrigeration?
How do I insert two edge loops equally spaced from the edges?
Why was this commercial plane highly delayed mid-flight?
Can a paladin prepare more spells if they didn't cast any the previous day?
Are (c#) dictionaries an Anti Pattern?
Why can't you say don't instead of won't?
How can I download a file from a host I can only SSH to through another host?
How could a self contained organic body propel itself in space
Does trying to charm an uncharmable creature cost a spell slot?
Counting the number of strings starting with “t” and containing 2 vowels and 2 consonants
Counting the number of a specific type of permutationHow can I generate permutations of bit strings with repetition?Counting number of inversionsCounting the total number of instances of some collection of objects in a listDetermine repeating number of a given number and corresponding positionDetermine the number of times a function will be calledCounting number of spheres that contain a pointCounting the permuted partitionsCounting the number of Configurations in an Array with ConstraintsCount sublists containing certain strings
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
I generated a list of strings that match the criteria in the title as follows:
vowels = Characters @ "aeiou";
consonants = DeleteCases[Complement[Alphabet[], vowels], "t"];
v = Select[Tuples[vowels, {2}], Length @ Tally @ # != 1];
c = Select[Tuples[consonants, {2}], Length @ Tally @ # != 1];
Flatten[#, 2] & @
Table[
Permutations[Flatten[{v[[i]], c[[j]]}], {4}],
{i, Length @ v}, {j, Length @ c}
];
words = DeleteDuplicates["t" <> # & /@ %];
Length @ words
(* 45600 *)
The count agrees with my math; there are $binom52$ ways of picking vowels, $binom{20}2$ ways of picking (non-t
) consonants, and $4!$ ways of arranging all but the first letter, hence $4!binom52binom{20}2=45600$ total words.
Is there a better way of generating all possible strings with the given criteria? I don't see a problem with my method, but think there is some corner-cutting that can be done.
combinatorics permutation counting
$endgroup$
add a comment |
$begingroup$
I generated a list of strings that match the criteria in the title as follows:
vowels = Characters @ "aeiou";
consonants = DeleteCases[Complement[Alphabet[], vowels], "t"];
v = Select[Tuples[vowels, {2}], Length @ Tally @ # != 1];
c = Select[Tuples[consonants, {2}], Length @ Tally @ # != 1];
Flatten[#, 2] & @
Table[
Permutations[Flatten[{v[[i]], c[[j]]}], {4}],
{i, Length @ v}, {j, Length @ c}
];
words = DeleteDuplicates["t" <> # & /@ %];
Length @ words
(* 45600 *)
The count agrees with my math; there are $binom52$ ways of picking vowels, $binom{20}2$ ways of picking (non-t
) consonants, and $4!$ ways of arranging all but the first letter, hence $4!binom52binom{20}2=45600$ total words.
Is there a better way of generating all possible strings with the given criteria? I don't see a problem with my method, but think there is some corner-cutting that can be done.
combinatorics permutation counting
$endgroup$
add a comment |
$begingroup$
I generated a list of strings that match the criteria in the title as follows:
vowels = Characters @ "aeiou";
consonants = DeleteCases[Complement[Alphabet[], vowels], "t"];
v = Select[Tuples[vowels, {2}], Length @ Tally @ # != 1];
c = Select[Tuples[consonants, {2}], Length @ Tally @ # != 1];
Flatten[#, 2] & @
Table[
Permutations[Flatten[{v[[i]], c[[j]]}], {4}],
{i, Length @ v}, {j, Length @ c}
];
words = DeleteDuplicates["t" <> # & /@ %];
Length @ words
(* 45600 *)
The count agrees with my math; there are $binom52$ ways of picking vowels, $binom{20}2$ ways of picking (non-t
) consonants, and $4!$ ways of arranging all but the first letter, hence $4!binom52binom{20}2=45600$ total words.
Is there a better way of generating all possible strings with the given criteria? I don't see a problem with my method, but think there is some corner-cutting that can be done.
combinatorics permutation counting
$endgroup$
I generated a list of strings that match the criteria in the title as follows:
vowels = Characters @ "aeiou";
consonants = DeleteCases[Complement[Alphabet[], vowels], "t"];
v = Select[Tuples[vowels, {2}], Length @ Tally @ # != 1];
c = Select[Tuples[consonants, {2}], Length @ Tally @ # != 1];
Flatten[#, 2] & @
Table[
Permutations[Flatten[{v[[i]], c[[j]]}], {4}],
{i, Length @ v}, {j, Length @ c}
];
words = DeleteDuplicates["t" <> # & /@ %];
Length @ words
(* 45600 *)
The count agrees with my math; there are $binom52$ ways of picking vowels, $binom{20}2$ ways of picking (non-t
) consonants, and $4!$ ways of arranging all but the first letter, hence $4!binom52binom{20}2=45600$ total words.
Is there a better way of generating all possible strings with the given criteria? I don't see a problem with my method, but think there is some corner-cutting that can be done.
combinatorics permutation counting
combinatorics permutation counting
asked 8 hours ago
user170231user170231
7375 silver badges13 bronze badges
7375 silver badges13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
For "counting the number of strings ..." you don't have to generate the list of such strings:
4! Binomial[Length @ vowels, 2] Binomial[Length @ consonants, 2]
45600
An alternative way to generate the list of words:
words = StringJoin["t", ##] & @@@ (Join @@ (Permutations /@ (Join @@@
Tuples[Subsets[#, {2}] & /@ {vowels, consonants}])));
Length @ words
45600
words // Short
{taebc, taecb, tabec, tabce, taceb, << 45591 >>, tzuoy, tzuyo, tzyou, tzyuo}
$endgroup$
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
add a comment |
Your Answer
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',
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
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f204419%2fcounting-the-number-of-strings-starting-with-t-and-containing-2-vowels-and-2-c%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
$begingroup$
For "counting the number of strings ..." you don't have to generate the list of such strings:
4! Binomial[Length @ vowels, 2] Binomial[Length @ consonants, 2]
45600
An alternative way to generate the list of words:
words = StringJoin["t", ##] & @@@ (Join @@ (Permutations /@ (Join @@@
Tuples[Subsets[#, {2}] & /@ {vowels, consonants}])));
Length @ words
45600
words // Short
{taebc, taecb, tabec, tabce, taceb, << 45591 >>, tzuoy, tzuyo, tzyou, tzyuo}
$endgroup$
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
add a comment |
$begingroup$
For "counting the number of strings ..." you don't have to generate the list of such strings:
4! Binomial[Length @ vowels, 2] Binomial[Length @ consonants, 2]
45600
An alternative way to generate the list of words:
words = StringJoin["t", ##] & @@@ (Join @@ (Permutations /@ (Join @@@
Tuples[Subsets[#, {2}] & /@ {vowels, consonants}])));
Length @ words
45600
words // Short
{taebc, taecb, tabec, tabce, taceb, << 45591 >>, tzuoy, tzuyo, tzyou, tzyuo}
$endgroup$
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
add a comment |
$begingroup$
For "counting the number of strings ..." you don't have to generate the list of such strings:
4! Binomial[Length @ vowels, 2] Binomial[Length @ consonants, 2]
45600
An alternative way to generate the list of words:
words = StringJoin["t", ##] & @@@ (Join @@ (Permutations /@ (Join @@@
Tuples[Subsets[#, {2}] & /@ {vowels, consonants}])));
Length @ words
45600
words // Short
{taebc, taecb, tabec, tabce, taceb, << 45591 >>, tzuoy, tzuyo, tzyou, tzyuo}
$endgroup$
For "counting the number of strings ..." you don't have to generate the list of such strings:
4! Binomial[Length @ vowels, 2] Binomial[Length @ consonants, 2]
45600
An alternative way to generate the list of words:
words = StringJoin["t", ##] & @@@ (Join @@ (Permutations /@ (Join @@@
Tuples[Subsets[#, {2}] & /@ {vowels, consonants}])));
Length @ words
45600
words // Short
{taebc, taecb, tabec, tabce, taceb, << 45591 >>, tzuoy, tzuyo, tzyou, tzyuo}
edited 8 hours ago
answered 8 hours ago
kglrkglr
214k10 gold badges244 silver badges488 bronze badges
214k10 gold badges244 silver badges488 bronze badges
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
add a comment |
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
$begingroup$
Right, I was just trying to make an exercise in WL to confirm this count :)
$endgroup$
– user170231
8 hours ago
add a comment |
Thanks for contributing an answer to Mathematica 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f204419%2fcounting-the-number-of-strings-starting-with-t-and-containing-2-vowels-and-2-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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