def number_factor(PD, SC=30.0, OD=0.32153):
    """
    PD - Planet density
    OD - Optimal density
    SC - a number used to scale how bad it is to differ from the
         optimal density. Lower number means less bad
    Returns a number between 0.0 and 1.0 indicating how good the
    density of planets is compared to the optimal density
    """
    diff_from_opt = OD - PD
    exponent = -SC * diff_from_opt * diff_from_opt
    return pow(2.718281828, exponent)