Number of combinations of digits where consecutive identical digits cannot be inverted to produce a new combination

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











up vote
0
down vote

favorite












I have a number in base $10$ containing $N$ digits of $1$, and $1$ or more digits that are $1$-digit prime numbers. The prime number digits can be repeated.



For example, $111225777$.



I wish to know how many "combinations" (not in the usual mathematical sense) of the digits of this number exist for which consecutive identical digits do not form a new "combination". In other words, the order of the indices of $2$ digits matter only if the digits are different. For example, $2235$ has the 1st digit and the 2nd digit equal to $2$, a counted combination is $2325$ but just by inverting the first and the second digit you do not create a counted combination.



Update: Another example:



The matching combinations of the digits $K1111$ are



  1. $K1111$

  2. $1K111$

  3. $11K11$

  4. $111K1$

  5. $1111K$

In total here are 5 possibilities, not $2^5$.










share|cite|improve this question























  • Usually , $1$ is not considered to be a prime number.
    – Peter
    Sep 5 at 7:44










  • If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
    – N. F. Taussig
    Sep 5 at 7:56










  • The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
    – silviubogan
    Sep 5 at 8:26










  • In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
    – N. F. Taussig
    Sep 5 at 9:47










  • @N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
    – silviubogan
    Sep 7 at 8:50














up vote
0
down vote

favorite












I have a number in base $10$ containing $N$ digits of $1$, and $1$ or more digits that are $1$-digit prime numbers. The prime number digits can be repeated.



For example, $111225777$.



I wish to know how many "combinations" (not in the usual mathematical sense) of the digits of this number exist for which consecutive identical digits do not form a new "combination". In other words, the order of the indices of $2$ digits matter only if the digits are different. For example, $2235$ has the 1st digit and the 2nd digit equal to $2$, a counted combination is $2325$ but just by inverting the first and the second digit you do not create a counted combination.



Update: Another example:



The matching combinations of the digits $K1111$ are



  1. $K1111$

  2. $1K111$

  3. $11K11$

  4. $111K1$

  5. $1111K$

In total here are 5 possibilities, not $2^5$.










share|cite|improve this question























  • Usually , $1$ is not considered to be a prime number.
    – Peter
    Sep 5 at 7:44










  • If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
    – N. F. Taussig
    Sep 5 at 7:56










  • The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
    – silviubogan
    Sep 5 at 8:26










  • In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
    – N. F. Taussig
    Sep 5 at 9:47










  • @N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
    – silviubogan
    Sep 7 at 8:50












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a number in base $10$ containing $N$ digits of $1$, and $1$ or more digits that are $1$-digit prime numbers. The prime number digits can be repeated.



For example, $111225777$.



I wish to know how many "combinations" (not in the usual mathematical sense) of the digits of this number exist for which consecutive identical digits do not form a new "combination". In other words, the order of the indices of $2$ digits matter only if the digits are different. For example, $2235$ has the 1st digit and the 2nd digit equal to $2$, a counted combination is $2325$ but just by inverting the first and the second digit you do not create a counted combination.



Update: Another example:



The matching combinations of the digits $K1111$ are



  1. $K1111$

  2. $1K111$

  3. $11K11$

  4. $111K1$

  5. $1111K$

In total here are 5 possibilities, not $2^5$.










share|cite|improve this question















I have a number in base $10$ containing $N$ digits of $1$, and $1$ or more digits that are $1$-digit prime numbers. The prime number digits can be repeated.



For example, $111225777$.



I wish to know how many "combinations" (not in the usual mathematical sense) of the digits of this number exist for which consecutive identical digits do not form a new "combination". In other words, the order of the indices of $2$ digits matter only if the digits are different. For example, $2235$ has the 1st digit and the 2nd digit equal to $2$, a counted combination is $2325$ but just by inverting the first and the second digit you do not create a counted combination.



Update: Another example:



The matching combinations of the digits $K1111$ are



  1. $K1111$

  2. $1K111$

  3. $11K11$

  4. $111K1$

  5. $1111K$

In total here are 5 possibilities, not $2^5$.







combinatorics






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Sep 7 at 8:47

























asked Sep 5 at 7:21









silviubogan

1125




1125











  • Usually , $1$ is not considered to be a prime number.
    – Peter
    Sep 5 at 7:44










  • If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
    – N. F. Taussig
    Sep 5 at 7:56










  • The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
    – silviubogan
    Sep 5 at 8:26










  • In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
    – N. F. Taussig
    Sep 5 at 9:47










  • @N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
    – silviubogan
    Sep 7 at 8:50
















  • Usually , $1$ is not considered to be a prime number.
    – Peter
    Sep 5 at 7:44










  • If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
    – N. F. Taussig
    Sep 5 at 7:56










  • The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
    – silviubogan
    Sep 5 at 8:26










  • In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
    – N. F. Taussig
    Sep 5 at 9:47










  • @N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
    – silviubogan
    Sep 7 at 8:50















Usually , $1$ is not considered to be a prime number.
– Peter
Sep 5 at 7:44




Usually , $1$ is not considered to be a prime number.
– Peter
Sep 5 at 7:44












If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
– N. F. Taussig
Sep 5 at 7:56




If I understand your question correctly, you wish to count how many $N$-digit numbers can be formed with the digits $1, 2, 3, 5, 7$ if the order in which the digits appear does not matter. Please confirm or clarify.
– N. F. Taussig
Sep 5 at 7:56












The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
– silviubogan
Sep 5 at 8:26




The order in which the digits appear does matter, but only for different digits. It is just like, if I have the array 2, 2, 3, 5 in which the first 2 has the index 1 and the second 2 has the index 2, inverting them will not count as another "combination", but if I permute the indices array and obtain 2, 3, 2, 5, then this counts as another "combination".
– silviubogan
Sep 5 at 8:26












In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
– N. F. Taussig
Sep 5 at 9:47




In that case, there are five choices ($1, 2, 3, 5, 7$) for each of the $N$ positions, so there are $5^N$ possible sequences.
– N. F. Taussig
Sep 5 at 9:47












@N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
– silviubogan
Sep 7 at 8:50




@N.F.Taussig I updated the question with a new example, for which your formula is not functioning well.
– silviubogan
Sep 7 at 8:50










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










There seem to be two different questions here:




How many sequences of length $N$ can be formed using the digits $1, 2, 3, 5, 7$ with repetition?




There are five choices for each of the $N$ positions in the sequence, so there are $5^N$ such sequences.



This type of problem is called a permutation with repetition.




How many distinguishable sequences of length $N$ can be formed with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_7 = N$?




Let's consider the following example:



In how many distinguishable ways can the elements of the sequence $1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7$ be arranged?



There are a total of $1 + 2 + 3 + 5 + 7 = 18$ numbers in the sequence. We can fill one of the eighteen positions with the $1$ in $binom181$ ways, two of the remaining seventeen positions with the two $2$s in $binom172$ ways, three of the remaining fifteen positions with the three $3$s in $binom153$ ways, five of the remaining twelve positions with the five $5$s in $binom125$ ways, and all of the remaining seven positions with the seven $7$s in $binom77$ ways. Hence, there are
$$binom181binom172binom153binom125binom77 = frac18!1!17! cdot frac17!2!15! cdot frac15!3!12! cdot frac12!5!7! cdot frac7!7!0! = frac18!1!2!3!5!7!$$
such arrangements. The factors of $1!$, $2!$, $3!$, $5!$, $7!$ in the denominator represent, respectively, the number of ways the $1$s, $2$s, $3$s, $5$s, and $7$s can be permuted among themselves within a given arrangement without producing an arrangement that is distinguishable from the given arrangement.



By similar reasoning, the number of distinguishable arrangements of a sequence of length $N$ with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_5 + n_7 = N$ is
$$binomNn_1binomN - n_1n_2binomN - n_1 - n_2n_3binomN - n_1 - n_2 - n_3n_5binomN - n_1 - n_2 - n_3 - n_5n_7 = fracN!n_1!n_2!n_3!n_5!n_7!$$



This type of problem is called a permutation of a multiset.






share|cite|improve this answer




















    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: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    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%2f2905973%2fnumber-of-combinations-of-digits-where-consecutive-identical-digits-cannot-be-in%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
    1
    down vote



    accepted










    There seem to be two different questions here:




    How many sequences of length $N$ can be formed using the digits $1, 2, 3, 5, 7$ with repetition?




    There are five choices for each of the $N$ positions in the sequence, so there are $5^N$ such sequences.



    This type of problem is called a permutation with repetition.




    How many distinguishable sequences of length $N$ can be formed with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_7 = N$?




    Let's consider the following example:



    In how many distinguishable ways can the elements of the sequence $1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7$ be arranged?



    There are a total of $1 + 2 + 3 + 5 + 7 = 18$ numbers in the sequence. We can fill one of the eighteen positions with the $1$ in $binom181$ ways, two of the remaining seventeen positions with the two $2$s in $binom172$ ways, three of the remaining fifteen positions with the three $3$s in $binom153$ ways, five of the remaining twelve positions with the five $5$s in $binom125$ ways, and all of the remaining seven positions with the seven $7$s in $binom77$ ways. Hence, there are
    $$binom181binom172binom153binom125binom77 = frac18!1!17! cdot frac17!2!15! cdot frac15!3!12! cdot frac12!5!7! cdot frac7!7!0! = frac18!1!2!3!5!7!$$
    such arrangements. The factors of $1!$, $2!$, $3!$, $5!$, $7!$ in the denominator represent, respectively, the number of ways the $1$s, $2$s, $3$s, $5$s, and $7$s can be permuted among themselves within a given arrangement without producing an arrangement that is distinguishable from the given arrangement.



    By similar reasoning, the number of distinguishable arrangements of a sequence of length $N$ with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_5 + n_7 = N$ is
    $$binomNn_1binomN - n_1n_2binomN - n_1 - n_2n_3binomN - n_1 - n_2 - n_3n_5binomN - n_1 - n_2 - n_3 - n_5n_7 = fracN!n_1!n_2!n_3!n_5!n_7!$$



    This type of problem is called a permutation of a multiset.






    share|cite|improve this answer
























      up vote
      1
      down vote



      accepted










      There seem to be two different questions here:




      How many sequences of length $N$ can be formed using the digits $1, 2, 3, 5, 7$ with repetition?




      There are five choices for each of the $N$ positions in the sequence, so there are $5^N$ such sequences.



      This type of problem is called a permutation with repetition.




      How many distinguishable sequences of length $N$ can be formed with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_7 = N$?




      Let's consider the following example:



      In how many distinguishable ways can the elements of the sequence $1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7$ be arranged?



      There are a total of $1 + 2 + 3 + 5 + 7 = 18$ numbers in the sequence. We can fill one of the eighteen positions with the $1$ in $binom181$ ways, two of the remaining seventeen positions with the two $2$s in $binom172$ ways, three of the remaining fifteen positions with the three $3$s in $binom153$ ways, five of the remaining twelve positions with the five $5$s in $binom125$ ways, and all of the remaining seven positions with the seven $7$s in $binom77$ ways. Hence, there are
      $$binom181binom172binom153binom125binom77 = frac18!1!17! cdot frac17!2!15! cdot frac15!3!12! cdot frac12!5!7! cdot frac7!7!0! = frac18!1!2!3!5!7!$$
      such arrangements. The factors of $1!$, $2!$, $3!$, $5!$, $7!$ in the denominator represent, respectively, the number of ways the $1$s, $2$s, $3$s, $5$s, and $7$s can be permuted among themselves within a given arrangement without producing an arrangement that is distinguishable from the given arrangement.



      By similar reasoning, the number of distinguishable arrangements of a sequence of length $N$ with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_5 + n_7 = N$ is
      $$binomNn_1binomN - n_1n_2binomN - n_1 - n_2n_3binomN - n_1 - n_2 - n_3n_5binomN - n_1 - n_2 - n_3 - n_5n_7 = fracN!n_1!n_2!n_3!n_5!n_7!$$



      This type of problem is called a permutation of a multiset.






      share|cite|improve this answer






















        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        There seem to be two different questions here:




        How many sequences of length $N$ can be formed using the digits $1, 2, 3, 5, 7$ with repetition?




        There are five choices for each of the $N$ positions in the sequence, so there are $5^N$ such sequences.



        This type of problem is called a permutation with repetition.




        How many distinguishable sequences of length $N$ can be formed with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_7 = N$?




        Let's consider the following example:



        In how many distinguishable ways can the elements of the sequence $1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7$ be arranged?



        There are a total of $1 + 2 + 3 + 5 + 7 = 18$ numbers in the sequence. We can fill one of the eighteen positions with the $1$ in $binom181$ ways, two of the remaining seventeen positions with the two $2$s in $binom172$ ways, three of the remaining fifteen positions with the three $3$s in $binom153$ ways, five of the remaining twelve positions with the five $5$s in $binom125$ ways, and all of the remaining seven positions with the seven $7$s in $binom77$ ways. Hence, there are
        $$binom181binom172binom153binom125binom77 = frac18!1!17! cdot frac17!2!15! cdot frac15!3!12! cdot frac12!5!7! cdot frac7!7!0! = frac18!1!2!3!5!7!$$
        such arrangements. The factors of $1!$, $2!$, $3!$, $5!$, $7!$ in the denominator represent, respectively, the number of ways the $1$s, $2$s, $3$s, $5$s, and $7$s can be permuted among themselves within a given arrangement without producing an arrangement that is distinguishable from the given arrangement.



        By similar reasoning, the number of distinguishable arrangements of a sequence of length $N$ with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_5 + n_7 = N$ is
        $$binomNn_1binomN - n_1n_2binomN - n_1 - n_2n_3binomN - n_1 - n_2 - n_3n_5binomN - n_1 - n_2 - n_3 - n_5n_7 = fracN!n_1!n_2!n_3!n_5!n_7!$$



        This type of problem is called a permutation of a multiset.






        share|cite|improve this answer












        There seem to be two different questions here:




        How many sequences of length $N$ can be formed using the digits $1, 2, 3, 5, 7$ with repetition?




        There are five choices for each of the $N$ positions in the sequence, so there are $5^N$ such sequences.



        This type of problem is called a permutation with repetition.




        How many distinguishable sequences of length $N$ can be formed with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_7 = N$?




        Let's consider the following example:



        In how many distinguishable ways can the elements of the sequence $1, 2, 2, 3, 3, 3, 5, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7$ be arranged?



        There are a total of $1 + 2 + 3 + 5 + 7 = 18$ numbers in the sequence. We can fill one of the eighteen positions with the $1$ in $binom181$ ways, two of the remaining seventeen positions with the two $2$s in $binom172$ ways, three of the remaining fifteen positions with the three $3$s in $binom153$ ways, five of the remaining twelve positions with the five $5$s in $binom125$ ways, and all of the remaining seven positions with the seven $7$s in $binom77$ ways. Hence, there are
        $$binom181binom172binom153binom125binom77 = frac18!1!17! cdot frac17!2!15! cdot frac15!3!12! cdot frac12!5!7! cdot frac7!7!0! = frac18!1!2!3!5!7!$$
        such arrangements. The factors of $1!$, $2!$, $3!$, $5!$, $7!$ in the denominator represent, respectively, the number of ways the $1$s, $2$s, $3$s, $5$s, and $7$s can be permuted among themselves within a given arrangement without producing an arrangement that is distinguishable from the given arrangement.



        By similar reasoning, the number of distinguishable arrangements of a sequence of length $N$ with $n_1$ $1$s, $n_2$ $2$s, $n_3$ $3$s, $n_5$ $5$s, and $n_7$ $7$s, where $n_1 + n_2 + n_3 + n_5 + n_5 + n_7 = N$ is
        $$binomNn_1binomN - n_1n_2binomN - n_1 - n_2n_3binomN - n_1 - n_2 - n_3n_5binomN - n_1 - n_2 - n_3 - n_5n_7 = fracN!n_1!n_2!n_3!n_5!n_7!$$



        This type of problem is called a permutation of a multiset.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Sep 7 at 9:37









        N. F. Taussig

        39.6k93153




        39.6k93153



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2905973%2fnumber-of-combinations-of-digits-where-consecutive-identical-digits-cannot-be-in%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Carbon dioxide

            Why am i infinitely getting the same tweet with the Twitter Search API?