dCode is free and its tools are a valuable help in games, puzzles and problems to solve every day! You have a problem, an idea for a project, a specific need and dCode can not (yet) help you? You need custom development? Contact-me!

Tool to generate combinations with repetitions. In Mathematics, a combination with repetitions is a combinations of items which can be repeated.

Answers to Questions

How to generate combinations with repetition?

Item combinations with repetition consist in generating the list of all possible arrangements of elements (each can be repeated) in any order.

Example: A,B,C items be shuffled in 6 couples of 2 items: A,AA,BA,CB,BB,C, C,C. Without repetition, there would be only 3 couples A,B, A,C et B,C.

The sets of n elements are called tuples: {1,2} or {1,2,3} are tuples.

How to count combinations with repetition?

Counting repeated combinations of k items (sometimes called k-combination) in a list of N is noted \( \Gamma_n^k \) and $$ \Gamma_n^k = {n+k-1 \choose k} = \frac{(n+k-1)!}{k! (n-1)!} $$

The number of combinations with repeats of \( k \) items among \( N \) is equal to the number of combinations without repeats of \( k \) items among \( N + k - 1 \).

How to remove the limit when computing combinations?

The calculation of the combinations generates an exponential number of values which require large calculation servers, generations have therefore a cost.

Ask a new question

Source code

dCode retains ownership of the source code of the script Combinations with Repetition online. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, Matlab, etc.) which dCode owns rights will not be given for free. So if you need to download the online Combinations with Repetition script for offline use, check contact page !