def generalized_golden_ratio(dim):
    """
    Using nested radical formula to calculate generalized golden ratio.

    Args:
        dim (int):
            The number of dimension the ratio is to be used in.

    Returns:
        (float):
            The generalize golden ratio for dimension `dim`.

    Examples:
        >>> generalized_golden_ratio(1)
        1.618033988749895
        >>> generalized_golden_ratio(2)
        1.324717957244746
        >>> generalized_golden_ratio(100)
        1.0069208854344955
    """
    out = 1.7
    out_ = 1.
    while out != out_:
        out, out_ = out_, (1+out)**(1./(dim+1))
    return out_