A lottery winner needs to bet on 6 numbers from an array specified as listed below.
to extract the possible combinations - the code consists of two parts :
phase 1 - get all the permutations:
a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37]
combinations = tuple(itertools.permutations(a, 6))
phase 2 - deduct all combinations:
I took some help from a different post here to remove any such duplicates because in lottery the combination [1,3,5]
is similar to betting on [5,1,3]
.
The machine has launched, and crashed out of memory before ending phase 1.
I know most of you would recommend an upgrade to 64bit etc, but I'm looking to find a more efficient code to process the necessary results on the current machine I have. mainly for learning purposes.
many thanks for your reply !