import random

data = (131, 787, 881) 

max_table = 20000
table = []
table_not = [x for x in range(max_table)]

for i in range(len(data)):
    n = 1
    while data[i]*n <= max_table:
        if data[i]*n in table_not:
            table.append(data[i]*n)
            table_not.remove(data[i]*n)
        n += 1

while(len(table)>0):
    to_be_removed = list()
    for i in table.copy():
        for n in data:
            if n+i in table_not:
                table.append(n+i)
                table_not.remove(n+i)
        to_be_removed.append(i)
    table = [n for n in table if n not in to_be_removed] 
    print(len(table), len(table_not), max(table_not))
