(D, N, t=symbols("t", integer=True))
return sol
Uses brute force to solve the equation, `x^2 - Dy^2 = N`.

    Mainly concerned with the generalized Pell equation which is the case when
    `D > 0, D` is not a perfect square. For more information on the case refer
    [1]_. Let `(t, u)` be the minimal positive solution of the equation
    `x^2 - Dy^2 = 1`. Then this method requires
    `\sqrt{\\frac{\mid N \mid (t \pm 1)}{2D}}` to be small.

    Usage
    =====

    ``diop_bf_DN(D, N, t)``: ``D`` and ``N`` are coefficients in
    `x^2 - Dy^2 = N` and ``t`` is the parameter to be used in the solutions.

    Details
    =======

    ``D`` and ``N`` correspond to D and N in the equation.
    ``t`` is the parameter to be used in the solutions.

    Examples
    ========

    >>> from sympy.solvers.diophantine import diop_bf_DN
    >>> diop_bf_DN(13, -4)
    [(3, 1), (-3, 1), (36, 10)]
    >>> diop_bf_DN(986, 1)
    [(49299, 1570)]

    See Also
    ========

    diop_DN()

    References
    ==========

    .. [1] Solving the generalized Pell equation x**2 - D*y**2 = N, John P.
        Robertson, July 31, 2004, Page 15. http://www.jpr2718.org/pell.pdf
Uses brute force to solve the equation, `x^2 - Dy^2 = N`.
Uses brute force to solve the equation x^2 - Dy^2 = N .
def diop_bf_DN(D, N, t=symbols("t", integer=True)):
    """
    Uses brute force to solve the equation, `x^2 - Dy^2 = N`.

    Mainly concerned with the generalized Pell equation which is the case when
    `D > 0, D` is not a perfect square. For more information on the case refer
    [1]_. Let `(t, u)` be the minimal positive solution of the equation
    `x^2 - Dy^2 = 1`. Then this method requires
    `\sqrt{\\frac{\mid N \mid (t \pm 1)}{2D}}` to be small.

    Usage
    =====

    ``diop_bf_DN(D, N, t)``: ``D`` and ``N`` are coefficients in
    `x^2 - Dy^2 = N` and ``t`` is the parameter to be used in the solutions.

    Details
    =======

    ``D`` and ``N`` correspond to D and N in the equation.
    ``t`` is the parameter to be used in the solutions.

    Examples
    ========

    >>> from sympy.solvers.diophantine import diop_bf_DN
    >>> diop_bf_DN(13, -4)
    [(3, 1), (-3, 1), (36, 10)]
    >>> diop_bf_DN(986, 1)
    [(49299, 1570)]

    See Also
    ========

    diop_DN()

    References
    ==========

    .. [1] Solving the generalized Pell equation x**2 - D*y**2 = N, John P.
        Robertson, July 31, 2004, Page 15. http://www.jpr2718.org/pell.pdf
    """
    sol = []
    a = diop_DN(D, 1)
    u = a[0][0]
    v = a[0][1]


    if abs(N) == 1:
        return diop_DN(D, N)

    elif N > 1:
        L1 = 0
        L2 = floor(sqrt(S(N*(u - 1))/(2*D))) + 1

    elif N < -1:
        L1 = ceiling(sqrt(S(-N)/D))
        L2 = floor(sqrt(S(-N*(u + 1))/(2*D))) + 1

    else:
        if D < 0:
            return [(S.Zero, S.Zero)]
        elif D == 0:
            return [(S.Zero, t)]
        else:
            if isinstance(sqrt(D), Integer):
                return [(sqrt(D)*t, t), (-sqrt(D)*t, t)]
            else:
                return [(S.Zero, S.Zero)]


    for y in xrange(L1, L2):
        if isinstance(sqrt(N + D*y**2), Integer):
            x = sqrt(N + D*y**2)
            sol.append((x, y))
            if not equivalent(x, y, -x, y, D, N):
                sol.append((-x, y))

    return sol
def diop_bf_DN ( D , N , t = symbols ( "t" , integer = True ) ) : sol = [ ] a = diop_DN ( D , 1 ) u = a [ 0 ] [ 0 ] v = a [ 0 ] [ 1 ] if abs ( N ) == 1 : return diop_DN ( D , N ) elif N > 1 : L1 = 0 L2 = floor ( sqrt ( S ( N * ( u - 1 ) ) / ( 2 * D ) ) ) + 1 elif N < - 1 : L1 = ceiling ( sqrt ( S ( - N ) / D ) ) L2 = floor ( sqrt ( S ( - N * ( u + 1 ) ) / ( 2 * D ) ) ) + 1 else : if D < 0 : return [ ( S . Zero , S . Zero ) ] elif D == 0 : return [ ( S . Zero , t ) ] else : if isinstance ( sqrt ( D ) , Integer ) : return [ ( sqrt ( D ) * t , t ) , ( - sqrt ( D ) * t , t ) ] else : return [ ( S . Zero , S . Zero ) ] for y in xrange ( L1 , L2 ) : if isinstance ( sqrt ( N + D * y ** 2 ) , Integer ) : x = sqrt ( N + D * y ** 2 ) sol . append ( ( x , y ) ) if not equivalent ( x , y , - x , y , D , N ) : sol . append ( ( - x , y ) ) return sol