B
B
BruttoNetto2020-04-29 22:56:40
Combinatorics
BruttoNetto, 2020-04-29 22:56:40

How many non-repeating combinations of numbers 1,2,3,4,5,6,7,8 will be four digits in a combination?

For example,


1234
5678
1258
1358
1458

That is, 1111, 2222, 1122 should not be repeated.

And is it possible to display all these combinations on the screen using javascript or another tool?
Maybe you can make a script of some kind?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
SagePtr, 2020-04-30
@BruttoNetto

What about thinking?
The first digit can be chosen in 8 ways (from 1 to 8), the second in 7 ways (from 1 to 8, excluding the first digit, as there are no repetitions), the third in 6 ways, and the fourth in 5 ways. In total, we get 8 * 7 * 6 * 5.

R
Rsa97, 2020-04-29
@Rsa97

1680
You can make a script, do it.

A
aRegius, 2020-04-30
@aRegius

>>> import itertools
>>> four_numbers_combinations = list(itertools.permutations(eight_numbers_list, 4))
>>> len(four_numbers_combinations)
1680
>>> four_numbers_combinations[:10]
[(1, 2, 3, 4), (1, 2, 3, 5), (1, 2, 3, 6), (1, 2, 3, 7), (1, 2, 3, 8), (1, 2, 4, 3), (1, 2, 4, 5), (1, 2, 4, 6), (1, 2, 4, 7), (1, 2, 4, 8)]

W
wisgest, 2020-05-08
@wisgest

Combination - Wikipedia .
Use the search to find a general algorithm for (generating | generating | finding) combinations .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question