import math


def exponential_decay(start=1000, decay=0.5):
    """
    Returns the next batch size which has a exponential decay.

    With default parameters we have:
    0:1000, 1:606.53, 2:367.88, 3:223.13, 4:135.34, 5:82.08

    Increase decay for a faster slow down of batches.

    This function is useful to jump to a certain size quickly and to slow down
    growth then.

    Always returns the lower integer with min 1.

    :start First batch size.
    :decay Exponential decay constant.
    """
    def inner(step):
        extact = start * math.exp(-1 * step * decay)
        approx = math.floor(extact)
        return max(1, approx)
    return inner