Sample size check based on reported percentages

Python function:

def compatibles(minimum, maximum, percents, digits=1): 
    compatibles=[]
    for i in range(minimum, maximum+1):
        compatible = True
        for percent in [round(p, digits) for p in percents]:
            estimate = i*percent/100 // 1
            if percent not in [round(estimate/i*100, digits), 
                               round((estimate+1)/i*100, digits)]:
                compatible = False
        if compatible: compatibles.append(i)
    return compatibles
# Use: compatibles(20, 500, [10.1, 23.1, 34.5], 1)
# will output all sample sizes from 20 to 500 compatible 
# with percentages of 10.1, 23.1, 34.5 rounded to 1 digit.
by Artemiy Okhotin using Shiny for Python