def determine_num_samples(distance_m):
    """
    Guarantee a number of samples between 2 and 600.

    Longley-Rice Irregular Terrain Model is limited to only 600
    surface points, so this function ensures this number is not
    passed.

    Parameters
    ----------
    distance_m : int
        Distance between transmitter and receiver in meters.

    Returns
    -------
    num_samples : int
        Number of samples between 2 and 600.

    """
    # This is -1/x translated and rescaled:
    # - to hit 2 at x=0
    # - to approach 600 as x->inf

    # Online plot to get a feel for the function:
    # https://www.wolframalpha.com/input/?i=plot+%28-1%2F%280.0001x%2B%281%2F598%29%29%29+%2B+600+from+0+to+100

    # Limits:
    # https://www.wolframalpha.com/input/?i=limit+%28-1%2F%280.0001x%2B%281%2F598%29%29%29+%2B+600

    stretch = 1e-5
    lower_limit = 2
    upper_limit = 600

    return round(
        (
            -1 /
            (
                (stretch * distance_m) +
                (1 / (upper_limit - lower_limit))
            )
        ) +
        upper_limit
    )