Number of strings of length 8 using ABCDEF that contain ABC?
$begingroup$
Here is my attempt to calculate the number of strings of length $8$ using $6$ characters (ABCDEF) which contain 'ABC'. Basically I wanted to see if my approach is correct or if there is a better way to calculate this.
Basically we consider ABC like an element by itself, and it can go:
ABC X X X X X
X ABC X X X X
X X ABC X X X
X X X ABC X X
X X X X ABC X
X X X X X ABC
Where the X represents another character. So we have $6$ rows and in each row there are $6^5$ possibilities (can choose between $6$ chars. and have $5$ spots), therefore we have $6^6$ combinations.
However there are repetitions, which are the following cases:
ABC ABC X X
ABC X ABC X
ABC X X ABC
X ABC ABC X
X ABC X ABC
X X ABC ABC
So we subtract these possibilities which are $6^3$ ($6 cdot 6^2$ because there are $6$ rows and $2$ spots for $6$ chars in each row)
So we end up with $6^6 - 6^3$.
Thank you in advance.
combinatorics
$endgroup$
add a comment |
$begingroup$
Here is my attempt to calculate the number of strings of length $8$ using $6$ characters (ABCDEF) which contain 'ABC'. Basically I wanted to see if my approach is correct or if there is a better way to calculate this.
Basically we consider ABC like an element by itself, and it can go:
ABC X X X X X
X ABC X X X X
X X ABC X X X
X X X ABC X X
X X X X ABC X
X X X X X ABC
Where the X represents another character. So we have $6$ rows and in each row there are $6^5$ possibilities (can choose between $6$ chars. and have $5$ spots), therefore we have $6^6$ combinations.
However there are repetitions, which are the following cases:
ABC ABC X X
ABC X ABC X
ABC X X ABC
X ABC ABC X
X ABC X ABC
X X ABC ABC
So we subtract these possibilities which are $6^3$ ($6 cdot 6^2$ because there are $6$ rows and $2$ spots for $6$ chars in each row)
So we end up with $6^6 - 6^3$.
Thank you in advance.
combinatorics
$endgroup$
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43
add a comment |
$begingroup$
Here is my attempt to calculate the number of strings of length $8$ using $6$ characters (ABCDEF) which contain 'ABC'. Basically I wanted to see if my approach is correct or if there is a better way to calculate this.
Basically we consider ABC like an element by itself, and it can go:
ABC X X X X X
X ABC X X X X
X X ABC X X X
X X X ABC X X
X X X X ABC X
X X X X X ABC
Where the X represents another character. So we have $6$ rows and in each row there are $6^5$ possibilities (can choose between $6$ chars. and have $5$ spots), therefore we have $6^6$ combinations.
However there are repetitions, which are the following cases:
ABC ABC X X
ABC X ABC X
ABC X X ABC
X ABC ABC X
X ABC X ABC
X X ABC ABC
So we subtract these possibilities which are $6^3$ ($6 cdot 6^2$ because there are $6$ rows and $2$ spots for $6$ chars in each row)
So we end up with $6^6 - 6^3$.
Thank you in advance.
combinatorics
$endgroup$
Here is my attempt to calculate the number of strings of length $8$ using $6$ characters (ABCDEF) which contain 'ABC'. Basically I wanted to see if my approach is correct or if there is a better way to calculate this.
Basically we consider ABC like an element by itself, and it can go:
ABC X X X X X
X ABC X X X X
X X ABC X X X
X X X ABC X X
X X X X ABC X
X X X X X ABC
Where the X represents another character. So we have $6$ rows and in each row there are $6^5$ possibilities (can choose between $6$ chars. and have $5$ spots), therefore we have $6^6$ combinations.
However there are repetitions, which are the following cases:
ABC ABC X X
ABC X ABC X
ABC X X ABC
X ABC ABC X
X ABC X ABC
X X ABC ABC
So we subtract these possibilities which are $6^3$ ($6 cdot 6^2$ because there are $6$ rows and $2$ spots for $6$ chars in each row)
So we end up with $6^6 - 6^3$.
Thank you in advance.
combinatorics
combinatorics
edited Dec 13 '18 at 23:39
N. F. Taussig
43.7k93355
43.7k93355
asked Dec 13 '18 at 23:31
m5signorinim5signorini
233
233
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43
add a comment |
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Your outcome is correct. This bruteforce calculation confirms it :D:
var count = 0;
for (let a0=0; a0<6; a0++)
for (let a1=0; a1<6; a1++)
for (let a2=0; a2<6; a2++)
for (let a3=0; a3<6; a3++)
for (let a4=0; a4<6; a4++)
for (let a5=0; a5<6; a5++)
for (let a6=0; a6<6; a6++)
for (let a7=0; a7<6; a7++) {
let s = a0+""+a1+""+a2+""+a3+""+a4+""+a5+""+a6+""+a7;
if (s.indexOf("012")>=0) count++;
}
console.log(count);
46440
Another way to do this is to consider the state machine that tests whether a string contains the subsequence "ABC":
We can use this to calculate the probability of a 8 letter word containing the subsequence "ABC". It is equivalent to whether we reach the state "ABC" starting from the empty one in 8 steps. The matrix is
$$left [
begin{array}\
frac{5}{6} & frac{1}{6} & 0 & 0 \
frac{4}{6} & frac{1}{6} & frac{1}{6} & 0 \
frac{4}{6} & frac{1}{6} & 0 & frac{1}{6} \
0 & 0 & 0 & 1 \
end{array}
right ]
$$
Its eight power's top-right element gives the answer
(1/6[[5, 1, 0, 0], [4, 1, 1,0], [4, 1, 0, 1], [0,0,0,6]])^8
$$frac{46440}{6^8}$$
$endgroup$
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
add a comment |
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
});
}
});
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%2fmath.stackexchange.com%2fquestions%2f3038737%2fnumber-of-strings-of-length-8-using-abcdef-that-contain-abc%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$
Your outcome is correct. This bruteforce calculation confirms it :D:
var count = 0;
for (let a0=0; a0<6; a0++)
for (let a1=0; a1<6; a1++)
for (let a2=0; a2<6; a2++)
for (let a3=0; a3<6; a3++)
for (let a4=0; a4<6; a4++)
for (let a5=0; a5<6; a5++)
for (let a6=0; a6<6; a6++)
for (let a7=0; a7<6; a7++) {
let s = a0+""+a1+""+a2+""+a3+""+a4+""+a5+""+a6+""+a7;
if (s.indexOf("012")>=0) count++;
}
console.log(count);
46440
Another way to do this is to consider the state machine that tests whether a string contains the subsequence "ABC":
We can use this to calculate the probability of a 8 letter word containing the subsequence "ABC". It is equivalent to whether we reach the state "ABC" starting from the empty one in 8 steps. The matrix is
$$left [
begin{array}\
frac{5}{6} & frac{1}{6} & 0 & 0 \
frac{4}{6} & frac{1}{6} & frac{1}{6} & 0 \
frac{4}{6} & frac{1}{6} & 0 & frac{1}{6} \
0 & 0 & 0 & 1 \
end{array}
right ]
$$
Its eight power's top-right element gives the answer
(1/6[[5, 1, 0, 0], [4, 1, 1,0], [4, 1, 0, 1], [0,0,0,6]])^8
$$frac{46440}{6^8}$$
$endgroup$
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
add a comment |
$begingroup$
Your outcome is correct. This bruteforce calculation confirms it :D:
var count = 0;
for (let a0=0; a0<6; a0++)
for (let a1=0; a1<6; a1++)
for (let a2=0; a2<6; a2++)
for (let a3=0; a3<6; a3++)
for (let a4=0; a4<6; a4++)
for (let a5=0; a5<6; a5++)
for (let a6=0; a6<6; a6++)
for (let a7=0; a7<6; a7++) {
let s = a0+""+a1+""+a2+""+a3+""+a4+""+a5+""+a6+""+a7;
if (s.indexOf("012")>=0) count++;
}
console.log(count);
46440
Another way to do this is to consider the state machine that tests whether a string contains the subsequence "ABC":
We can use this to calculate the probability of a 8 letter word containing the subsequence "ABC". It is equivalent to whether we reach the state "ABC" starting from the empty one in 8 steps. The matrix is
$$left [
begin{array}\
frac{5}{6} & frac{1}{6} & 0 & 0 \
frac{4}{6} & frac{1}{6} & frac{1}{6} & 0 \
frac{4}{6} & frac{1}{6} & 0 & frac{1}{6} \
0 & 0 & 0 & 1 \
end{array}
right ]
$$
Its eight power's top-right element gives the answer
(1/6[[5, 1, 0, 0], [4, 1, 1,0], [4, 1, 0, 1], [0,0,0,6]])^8
$$frac{46440}{6^8}$$
$endgroup$
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
add a comment |
$begingroup$
Your outcome is correct. This bruteforce calculation confirms it :D:
var count = 0;
for (let a0=0; a0<6; a0++)
for (let a1=0; a1<6; a1++)
for (let a2=0; a2<6; a2++)
for (let a3=0; a3<6; a3++)
for (let a4=0; a4<6; a4++)
for (let a5=0; a5<6; a5++)
for (let a6=0; a6<6; a6++)
for (let a7=0; a7<6; a7++) {
let s = a0+""+a1+""+a2+""+a3+""+a4+""+a5+""+a6+""+a7;
if (s.indexOf("012")>=0) count++;
}
console.log(count);
46440
Another way to do this is to consider the state machine that tests whether a string contains the subsequence "ABC":
We can use this to calculate the probability of a 8 letter word containing the subsequence "ABC". It is equivalent to whether we reach the state "ABC" starting from the empty one in 8 steps. The matrix is
$$left [
begin{array}\
frac{5}{6} & frac{1}{6} & 0 & 0 \
frac{4}{6} & frac{1}{6} & frac{1}{6} & 0 \
frac{4}{6} & frac{1}{6} & 0 & frac{1}{6} \
0 & 0 & 0 & 1 \
end{array}
right ]
$$
Its eight power's top-right element gives the answer
(1/6[[5, 1, 0, 0], [4, 1, 1,0], [4, 1, 0, 1], [0,0,0,6]])^8
$$frac{46440}{6^8}$$
$endgroup$
Your outcome is correct. This bruteforce calculation confirms it :D:
var count = 0;
for (let a0=0; a0<6; a0++)
for (let a1=0; a1<6; a1++)
for (let a2=0; a2<6; a2++)
for (let a3=0; a3<6; a3++)
for (let a4=0; a4<6; a4++)
for (let a5=0; a5<6; a5++)
for (let a6=0; a6<6; a6++)
for (let a7=0; a7<6; a7++) {
let s = a0+""+a1+""+a2+""+a3+""+a4+""+a5+""+a6+""+a7;
if (s.indexOf("012")>=0) count++;
}
console.log(count);
46440
Another way to do this is to consider the state machine that tests whether a string contains the subsequence "ABC":
We can use this to calculate the probability of a 8 letter word containing the subsequence "ABC". It is equivalent to whether we reach the state "ABC" starting from the empty one in 8 steps. The matrix is
$$left [
begin{array}\
frac{5}{6} & frac{1}{6} & 0 & 0 \
frac{4}{6} & frac{1}{6} & frac{1}{6} & 0 \
frac{4}{6} & frac{1}{6} & 0 & frac{1}{6} \
0 & 0 & 0 & 1 \
end{array}
right ]
$$
Its eight power's top-right element gives the answer
(1/6[[5, 1, 0, 0], [4, 1, 1,0], [4, 1, 0, 1], [0,0,0,6]])^8
$$frac{46440}{6^8}$$
answered Dec 14 '18 at 12:28
ploosu2ploosu2
4,5771023
4,5771023
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
add a comment |
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
$begingroup$
Cool! Thanks for the effort
$endgroup$
– m5signorini
Dec 14 '18 at 14:04
add a comment |
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.
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%2fmath.stackexchange.com%2fquestions%2f3038737%2fnumber-of-strings-of-length-8-using-abcdef-that-contain-abc%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
$begingroup$
Yeah good try. It seems to be the correct working to me!
$endgroup$
– Icycarus
Dec 13 '18 at 23:37
$begingroup$
Welcome to MathSE. Your solution is correct. Please read this tutorial on how to typeset mathematics on this site.
$endgroup$
– N. F. Taussig
Dec 13 '18 at 23:40
$begingroup$
Thanks for the quick responses, and the link, really needed it :)
$endgroup$
– m5signorini
Dec 13 '18 at 23:43