import math


def li_times(i, epsilon, delta):
    """
    Computes li, the optimal number of times to loop while sampling the
    equivalence oracle. This li is the reason pac-basis is sooo much faster
    than the original horn1 algorithm.

    Parameters:
    -----------------------------------
    i : int
        Number of times the equivalence oracle has been called already
    epsilon : float (0, 1)
            Tolerance for error in accuracy for the pac-basis
    delta : float (0, 1)
        Tolerance for confidence in confidence for the pac-basis
    """
    return((1.0 / epsilon) * (i - (math.log(delta) / math.log(2))))