Take 4 sums of sums, then add these 4 numbers to the sums of these 4 numbers, then repeat

Every year during the Super Bowl, my dad makes a bet with his friends, guesses the last point number, and anyone who knows correctly wins $ 20. My question is hard to explain in words, so I drew a diagram:http: //i.stack.  imgur.com/1ECrH.jpg

Basically I want to add 4 numbers (2, 3, 6, 7) to each other, then take 16 sums and add these 4 numbers to each of the sums. After I repeat this process about 100 times, I should have enough points to find basically all the final numbers and the most likely final number.

It will take a long time to do this manually, so I tried to write some code, but it was very difficult for a starter like me (half-done code below).

, Python 2.7.

sum_2 = {}
sum_3 = {}
sum_6 = {}
sum_7 = {}
nums = [2,3,6,7]
n_2 = 1
n_3 = 1
n_6 = 1
n_7 = 1
n_2_2 = n_2
n_3_3 = n_3
n_6_6 = n_6
n_7_7 = n_7
while n_7 < 10:
    for x in nums:
        sum_2[n_2] = x + x
        sum_2[n_2_2] = sum_2[n_2] + x
        n_2  = n_2 + 1
        n_2_2  = n_2 + 1

    for x in nums:
        sum_3[n_3] =  x + x
        sum_3[n_3_3] = sum_3[n_3] + x
        n_3 = n_3 + 1
        n_3_3  = n_3 + 1

    for x in nums:
        sum_6[n_6] =  x + x
        sum_6[n_6_6] = sum_6[n_6] + x
        n_6  = n_6 + 1
        n_6_6  = n_6 + 1

    for x in nums:
        sum_7[n_7] =  x + x
        sum_7[n_7_7] = sum_7[n_7] + x
        n_7  = n_7 + 1
        n_7_7  = n_7 + 1
else:
    print sum_2
    print sum_3
    print sum_6
    print sum_7
+4
1
nums = [2,3,6,7]
x = []
for i in range(5):
    for p in itertools.product(nums, repeat=i):
        x.append(sum(p))
+2

Source: https://habr.com/ru/post/1648437/


All Articles