(n)
return (2**v*d, 2**v*x, 2**v*y, 2**v*z)
Returns a 4-tuple `(a, b, c, d)` such that `a^2 + b^2 + c^2 + d^2 = n`.

    Here `a, b, c, d \geq 0`.

    Usage
    =====

    ``sum_of_four_squares(n)``: Here ``n`` is a non-negative integer.

    Examples
    ========

    >>> from sympy.solvers.diophantine import sum_of_four_squares
    >>> sum_of_four_squares(3456)
    (8, 48, 32, 8)
    >>> sum_of_four_squares(1294585930293)
    (0, 1137796, 2161, 1234)

    References
    ==========

    .. [1] Representing a number as a sum of four squares, [online],
        Available: http://www.schorn.ch/howto.html
Returns a 4-tuple `(a, b, c, d)` such that `a^2 + b^2 + c^2 + d^2 = n`.
Returns a 4 - tuple ( a b c d ) such that a^2 + b^2 + c^2 + d^2 = n .
def sum_of_four_squares(n):
    """
    Returns a 4-tuple `(a, b, c, d)` such that `a^2 + b^2 + c^2 + d^2 = n`.

    Here `a, b, c, d \geq 0`.

    Usage
    =====

    ``sum_of_four_squares(n)``: Here ``n`` is a non-negative integer.

    Examples
    ========

    >>> from sympy.solvers.diophantine import sum_of_four_squares
    >>> sum_of_four_squares(3456)
    (8, 48, 32, 8)
    >>> sum_of_four_squares(1294585930293)
    (0, 1137796, 2161, 1234)

    References
    ==========

    .. [1] Representing a number as a sum of four squares, [online],
        Available: http://www.schorn.ch/howto.html
    """
    if n == 0:
        return (0, 0, 0, 0)

    v = 0
    while n % 4 == 0:
        v = v + 1
        n = n // 4

    if n % 8 == 7:
        d = 2
        n = n - 4
    elif n % 8 == 6 or n % 8 == 2:
        d = 1
        n = n - 1
    else:
        d = 0

    x, y, z = sum_of_three_squares(n)

    return (2**v*d, 2**v*x, 2**v*y, 2**v*z)
def sum_of_four_squares ( n ) : if n == 0 : return ( 0 , 0 , 0 , 0 ) v = 0 while n % 4 == 0 : v = v + 1 n = n // 4 if n % 8 == 7 : d = 2 n = n - 4 elif n % 8 == 6 or n % 8 == 2 : d = 1 n = n - 1 else : d = 0 x , y , z = sum_of_three_squares ( n ) return ( 2 ** v * d , 2 ** v * x , 2 ** v * y , 2 ** v * z )