-2

Can you provide all possible combination of numbers 1 to 16 by 8 not to be repeated? For example 1 2 3 4 5 6 7 8 but should not to be repeated.

This will be the same for question like All Possible 6/45 Lottery Number Combinations. It just that what i need is 8/16, and yes i need all the number list.

This 1 to 16 numbers where 16 rumbled numbers i just used 1 to 16 numbers as mappings since in this way it will be easier rather than using the original 16 rumble numbers.

WMP
  • 13
  • 3
    This is not clear. You just want the number of ways to choose $8$ unordered elements out of $16$? That's $\binom {16}8$. – lulu Apr 04 '18 at 23:45
  • Thanks! It is most likely the same for question about all Possible 6/45 Lottery Number Combinations. The different is that what i want is 8/16. – WMP Apr 04 '18 at 23:55
  • @lulu 's comment tells you there are 12870 combinations on that list. We can't write them all down for you. – Ethan Bolker Apr 04 '18 at 23:56
  • To see how to count the number of ways of selecting a subset of $k$ elements from a set with $n$ elements, read this article on combinations. – N. F. Taussig Apr 04 '18 at 23:57

2 Answers2

1

Are you sure you're being asked to LIST them?
This is the combinations function on your calculator and you will realise that you are expecting to receive a large number of options, in fact $C(n,r)=\frac{n!}{(n-r)!r!}$ in this case we have $C(16,8)=\frac{16!}{(16-8)!8!}=12870$

Nobody
  • 162
0

The are indeed 12870 combinations, as mentioned in the comments. However, we can indeed write them all for you ;).

from itertools import combinations
r = list(range(1,17))
all_combinations = [",".join(map(str, comb)) for comb in combinations(r, 8)]

with open('combinations.txt', 'a') as f:
    f.write("\n".join(all_combinations))

produces

1,2,3,4,5,6,7,8
1,2,3,4,5,6,7,9
1,2,3,4,5,6,7,10
1,2,3,4,5,6,7,11
1,2,3,4,5,6,7,12
1,2,3,4,5,6,7,13
1,2,3,4,5,6,7,14
1,2,3,4,5,6,7,15
1,2,3,4,5,6,8,9
1,2,3,4,5,6,8,10
1,2,3,4,5,6,8,11
1,2,3,4,5,6,8,12
1,2,3,4,5,6,8,13
1,2,3,4,5,6,8,14
1,2,3,4,5,6,8,15
1,2,3,4,5,6,9,10
1,2,3,4,5,6,9,11
1,2,3,4,5,6,9,12
1,2,3,4,5,6,9,13
1,2,3,4,5,6,9,14
1,2,3,4,5,6,9,15
1,2,3,4,5,6,10,11
1,2,3,4,5,6,10,12
1,2,3,4,5,6,10,13
1,2,3,4,5,6,10,14
1,2,3,4,5,6,10,15
1,2,3,4,5,6,11,12
1,2,3,4,5,6,11,13
1,2,3,4,5,6,11,14
1,2,3,4,5,6,11,15
1,2,3,4,5,6,12,13
1,2,3,4,5,6,12,14
1,2,3,4,5,6,12,15
1,2,3,4,5,6,13,14
1,2,3,4,5,6,13,15
1,2,3,4,5,6,14,15
1,2,3,4,5,7,8,9
1,2,3,4,5,7,8,10
1,2,3,4,5,7,8,11
1,2,3,4,5,7,8,12
1,2,3,4,5,7,8,13
1,2,3,4,5,7,8,14
1,2,3,4,5,7,8,15
1,2,3,4,5,7,9,10
1,2,3,4,5,7,9,11
1,2,3,4,5,7,9,12
1,2,3,4,5,7,9,13
1,2,3,4,5,7,9,14
1,2,3,4,5,7,9,15
1,2,3,4,5,7,10,11
1,2,3,4,5,7,10,12
1,2,3,4,5,7,10,13
1,2,3,4,5,7,10,14
1,2,3,4,5,7,10,15
1,2,3,4,5,7,11,12
1,2,3,4,5,7,11,13
1,2,3,4,5,7,11,14
1,2,3,4,5,7,11,15
1,2,3,4,5,7,12,13
1,2,3,4,5,7,12,14
1,2,3,4,5,7,12,15
1,2,3,4,5,7,13,14
1,2,3,4,5,7,13,15
1,2,3,4,5,7,14,15
1,2,3,4,5,8,9,10
1,2,3,4,5,8,9,11
1,2,3,4,5,8,9,12
1,2,3,4,5,8,9,13
1,2,3,4,5,8,9,14
1,2,3,4,5,8,9,15
1,2,3,4,5,8,10,11
1,2,3,4,5,8,10,12
1,2,3,4,5,8,10,13
1,2,3,4,5,8,10,14
1,2,3,4,5,8,10,15
1,2,3,4,5,8,11,12
1,2,3,4,5,8,11,13
1,2,3,4,5,8,11,14
1,2,3,4,5,8,11,15
1,2,3,4,5,8,12,13
1,2,3,4,5,8,12,14
1,2,3,4,5,8,12,15
1,2,3,4,5,8,13,14
1,2,3,4,5,8,13,15
1,2,3,4,5,8,14,15
1,2,3,4,5,9,10,11
1,2,3,4,5,9,10,12
1,2,3,4,5,9,10,13
1,2,3,4,5,9,10,14
1,2,3,4,5,9,10,15
1,2,3,4,5,9,11,12
1,2,3,4,5,9,11,13
1,2,3,4,5,9,11,14
1,2,3,4,5,9,11,15
1,2,3,4,5,9,12,13
1,2,3,4,5,9,12,14
1,2,3,4,5,9,12,15
1,2,3,4,5,9,13,14
1,2,3,4,5,9,13,15
1,2,3,4,5,9,14,15
1,2,3,4,5,10,11,12
1,2,3,4,5,10,11,13
1,2,3,4,5,10,11,14
1,2,3,4,5,10,11,15
1,2,3,4,5,10,12,13
1,2,3,4,5,10,12,14
1,2,3,4,5,10,12,15
1,2,3,4,5,10,13,14
1,2,3,4,5,10,13,15
1,2,3,4,5,10,14,15
1,2,3,4,5,11,12,13
1,2,3,4,5,11,12,14
1,2,3,4,5,11,12,15
1,2,3,4,5,11,13,14
1,2,3,4,5,11,13,15
1,2,3,4,5,11,14,15
1,2,3,4,5,12,13,14
1,2,3,4,5,12,13,15
1,2,3,4,5,12,14,15
1,2,3,4,5,13,14,15
1,2,3,4,6,7,8,9
1,2,3,4,6,7,8,10
1,2,3,4,6,7,8,11
1,2,3,4,6,7,8,12
1,2,3,4,6,7,8,13
1,2,3,4,6,7,8,14
1,2,3,4,6,7,8,15
1,2,3,4,6,7,9,10
1,2,3,4,6,7,9,11
1,2,3,4,6,7,9,12
1,2,3,4,6,7,9,13
1,2,3,4,6,7,9,14
1,2,3,4,6,7,9,15
1,2,3,4,6,7,10,11
1,2,3,4,6,7,10,12
1,2,3,4,6,7,10,13
1,2,3,4,6,7,10,14
1,2,3,4,6,7,10,15
1,2,3,4,6,7,11,12
1,2,3,4,6,7,11,13
1,2,3,4,6,7,11,14
1,2,3,4,6,7,11,15
1,2,3,4,6,7,12,13
1,2,3,4,6,7,12,14
1,2,3,4,6,7,12,15
1,2,3,4,6,7,13,14
1,2,3,4,6,7,13,15
1,2,3,4,6,7,14,15
1,2,3,4,6,8,9,10
1,2,3,4,6,8,9,11
1,2,3,4,6,8,9,12
1,2,3,4,6,8,9,13
1,2,3,4,6,8,9,14
1,2,3,4,6,8,9,15
1,2,3,4,6,8,10,11
1,2,3,4,6,8,10,12
1,2,3,4,6,8,10,13
1,2,3,4,6,8,10,14
1,2,3,4,6,8,10,15
1,2,3,4,6,8,11,12
1,2,3,4,6,8,11,13
1,2,3,4,6,8,11,14
1,2,3,4,6,8,11,15
1,2,3,4,6,8,12,13
1,2,3,4,6,8,12,14
1,2,3,4,6,8,12,15
1,2,3,4,6,8,13,14
1,2,3,4,6,8,13,15
1,2,3,4,6,8,14,15
1,2,3,4,6,9,10,11
1,2,3,4,6,9,10,12
1,2,3,4,6,9,10,13
1,2,3,4,6,9,10,14
1,2,3,4,6,9,10,15
1,2,3,4,6,9,11,12
1,2,3,4,6,9,11,13
1,2,3,4,6,9,11,14
1,2,3,4,6,9,11,15
1,2,3,4,6,9,12,13
1,2,3,4,6,9,12,14
1,2,3,4,6,9,12,15
1,2,3,4,6,9,13,14
1,2,3,4,6,9,13,15
1,2,3,4,6,9,14,15
1,2,3,4,6,10,11,12
1,2,3,4,6,10,11,13
1,2,3,4,6,10,11,14
1,2,3,4,6,10,11,15
1,2,3,4,6,10,12,13
1,2,3,4,6,10,12,14
1,2,3,4,6,10,12,15
1,2,3,4,6,10,13,14
1,2,3,4,6,10,13,15
1,2,3,4,6,10,14,15
1,2,3,4,6,11,12,13
1,2,3,4,6,11,12,14
1,2,3,4,6,11,12,15
1,2,3,4,6,11,13,14
1,2,3,4,6,11,13,15
1,2,3,4,6,11,14,15
1,2,3,4,6,12,13,14
1,2,3,4,6,12,13,15
1,2,3,4,6,12,14,15
1,2,3,4,6,13,14,15
1,2,3,4,7,8,9,10
1,2,3,4,7,8,9,11
1,2,3,4,7,8,9,12
1,2,3,4,7,8,9,13
1,2,3,4,7,8,9,14
1,2,3,4,7,8,9,15
1,2,3,4,7,8,10,11
1,2,3,4,7,8,10,12
1,2,3,4,7,8,10,13
1,2,3,4,7,8,10,14
1,2,3,4,7,8,10,15
1,2,3,4,7,8,11,12
1,2,3,4,7,8,11,13
1,2,3,4,7,8,11,14
1,2,3,4,7,8,11,15
1,2,3,4,7,8,12,13
1,2,3,4,7,8,12,14
1,2,3,4,7,8,12,15
1,2,3,4,7,8,13,14
1,2,3,4,7,8,13,15
1,2,3,4,7,8,14,15
1,2,3,4,7,9,10,11
1,2,3,4,7,9,10,12
1,2,3,4,7,9,10,13
1,2,3,4,7,9,10,14
1,2,3,4,7,9,10,15
1,2,3,4,7,9,11,12
1,2,3,4,7,9,11,13
1,2,3,4,7,9,11,14
1,2,3,4,7,9,11,15
1,2,3,4,7,9,12,13
1,2,3,4,7,9,12,14
1,2,3,4,7,9,12,15
1,2,3,4,7,9,13,14
1,2,3,4,7,9,13,15
1,2,3,4,7,9,14,15
1,2,3,4,7,10,11,12
1,2,3,4,7,10,11,13
1,2,3,4,7,10,11,14
1,2,3,4,7,10,11,15
1,2,3,4,7,10,12,13
1,2,3,4,7,10,12,14
1,2,3,4,7,10,12,15
1,2,3,4,7,10,13,14
1,2,3,4,7,10,13,15
1,2,3,4,7,10,14,15
1,2,3,4,7,11,12,13
1,2,3,4,7,11,12,14
1,2,3,4,7,11,12,15
1,2,3,4,7,11,13,14
1,2,3,4,7,11,13,15
1,2,3,4,7,11,14,15
1,2,3,4,7,12,13,14
1,2,3,4,7,12,13,15
1,2,3,4,7,12,14,15
1,2,3,4,7,13,14,15
1,2,3,4,8,9,10,11
1,2,3,4,8,9,10,12
1,2,3,4,8,9,10,13
1,2,3,4,8,9,10,14
1,2,3,4,8,9,10,15
1,2,3,4,8,9,11,12
1,2,3,4,8,9,11,13
1,2,3,4,8,9,11,14
1,2,3,4,8,9,11,15
1,2,3,4,8,9,12,13
1,2,3,4,8,9,12,14
1,2,3,4,8,9,12,15
1,2,3,4,8,9,13,14
1,2,3,4,8,9,13,15
1,2,3,4,8,9,14,15
1,2,3,4,8,10,11,12
1,2,3,4,8,10,11,13
1,2,3,4,8,10,11,14
1,2,3,4,8,10,11,15
1,2,3,4,8,10,12,13
1,2,3,4,8,10,12,14
1,2,3,4,8,10,12,15
1,2,3,4,8,10,13,14
1,2,3,4,8,10,13,15
1,2,3,4,8,10,14,15
1,2,3,4,8,11,12,13
1,2,3,4,8,11,12,14
1,2,3,4,8,11,12,15
1,2,3,4,8,11,13,14
1,2,3,4,8,11,13,15
1,2,3,4,8,11,14,15
1,2,3,4,8,12,13,14
1,2,3,4,8,12,13,15
1,2,3,4,8,12,14,15
1,2,3,4,8,13,14,15
1,2,3,4,9,10,11,12
1,2,3,4,9,10,11,13
1,2,3,4,9,10,11,14
1,2,3,4,9,10,11,15
1,2,3,4,9,10,12,13
1,2,3,4,9,10,12,14
1,2,3,4,9,10,12,15
1,2,3,4,9,10,13,14
1,2,3,4,9,10,13,15
1,2,3,4,9,10,14,15
1,2,3,4,9,11,12,13
1,2,3,4,9,11,12,14
1,2,3,4,9,11,12,15
1,2,3,4,9,11,13,14
1,2,3,4,9,11,13,15
1,2,3,4,9,11,14,15
1,2,3,4,9,12,13,14
1,2,3,4,9,12,13,15
1,2,3,4,9,12,14,15
1,2,3,4,9,13,14,15
1,2,3,4,10,11,12,13
1,2,3,4,10,11,12,14
1,2,3,4,10,11,12,15
1,2,3,4,10,11,13,14
1,2,3,4,10,11,13,15
1,2,3,4,10,11,14,15
1,2,3,4,10,12,13,14
1,2,3,4,10,12,13,15
1,2,3,4,10,12,14,15
1,2,3,4,10,13,14,15
1,2,3,4,11,12,13,14
1,2,3,4,11,12,13,15
1,2,3,4,11,12,14,15
1,2,3,4,11,13,14,15
1,2,3,4,12,13,14,15
1,2,3,5,6,7,8,9
1,2,3,5,6,7,8,10
1,2,3,5,6,7,8,11
1,2,3,5,6,7,8,12
1,2,3,5,6,7,8,13
1,2,3,5,6,7,8,14
1,2,3,5,6,7,8,15
1,2,3,5,6,7,9,10
1,2,3,5,6,7,9,11
1,2,3,5,6,7,9,12
1,2,3,5,6,7,9,13
1,2,3,5,6,7,9,14
1,2,3,5,6,7,9,15
1,2,3,5,6,7,10,11
1,2,3,5,6,7,10,12
1,2,3,5,6,7,10,13
1,2,3,5,6,7,10,14
1,2,3,5,6,7,10,15
1,2,3,5,6,7,11,12
1,2,3,5,6,7,11,13
1,2,3,5,6,7,11,14
1,2,3,5,6,7,11,15
1,2,3,5,6,7,12,13
1,2,3,5,6,7,12,14
1,2,3,5,6,7,12,15
1,2,3,5,6,7,13,14
1,2,3,5,6,7,13,15
1,2,3,5,6,7,14,15
1,2,3,5,6,8,9,10
1,2,3,5,6,8,9,11
1,2,3,5,6,8,9,12
1,2,3,5,6,8,9,13
1,2,3,5,6,8,9,14
1,2,3,5,6,8,9,15
1,2,3,5,6,8,10,11
1,2,3,5,6,8,10,12
1,2,3,5,6,8,10,13
1,2,3,5,6,8,10,14
1,2,3,5,6,8,10,15
1,2,3,5,6,8,11,12
1,2,3,5,6,8,11,13
1,2,3,5,6,8,11,14
1,2,3,5,6,8,11,15
1,2,3,5,6,8,12,13
1,2,3,5,6,8,12,14
1,2,3,5,6,8,12,15
1,2,3,5,6,8,13,14
1,2,3,5,6,8,13,15
1,2,3,5,6,8,14,15
1,2,3,5,6,9,10,11
1,2,3,5,6,9,10,12
1,2,3,5,6,9,10,13
1,2,3,5,6,9,10,14
1,2,3,5,6,9,10,15
1,2,3,5,6,9,11,12
1,2,3,5,6,9,11,13
...

run the code yourself to get the rest.

Nucl3ic
  • 545