klocey / partitions

python based code for integer partitioning
4 stars 4 forks source link

possible simplification of `min_max` #20

Closed smichr closed 3 years ago

smichr commented 8 years ago
def min_max(q, n):
    """ Find the smallest possible maximum value for the first part in a partition
    of q having n parts """
    test_qnk(q, n)
    min_int, r = divmod(q, n)
    return min_int + 1 if r else min_int
klocey commented 3 years ago

Done. Thanks @smichr.