Hi all,

Continuing on this line, I added a function jacobi_symbol which is a
generalization of legendre_symbol [0].
The corresponding pull request is #608.


[0] http://en.wikipedia.org/wiki/Jacobi_symbol

On Fri, Sep 16, 2011 at 3:36 AM, Hector <hector1...@gmail.com> wrote:

>
>
> On Fri, Sep 16, 2011 at 3:19 AM, Hector <hector1...@gmail.com> wrote:
>
>>
>>
>> On Fri, Sep 16, 2011 at 2:40 AM, Chris Smith <smi...@gmail.com> wrote:
>>
>>> instead of `a%p` write `a % p`. Also, since this will have to be
>>> computed again later you might as well do both at the same time:
>>>
>>> a, r = divmod(a, p)
>>
>> if not r:
>>>    return 0
>>> if is_quad_residue(a, p):
>>>    return 1
>>> else:
>>>    return -1
>>>
>>
>> for  a, p = 5, 11;  divmod(a, p) returns (0, 5) and we will be losing the
>> value of a if a < p and hence with little modification -
>>
>
> A little more modification -
>
>     _, a = divmod(a, p)
>     if not a :
>
>         return 0
>     if is_quad_residue(a, p):
>         return 1
>     else:
>         return -1
>
>
>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "sympy" group.
>>> To post to this group, send email to sympy@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sympy+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sympy?hl=en.
>>>
>>>
>>
>>
>> --
>> -Regards
>> Hector
>>
>> Whenever you think you can or you can't, in either way you are right.
>>
>>
>
>
> --
> -Regards
> Hector
>
> Whenever you think you can or you can't, in either way you are right.
>
>


-- 
-Regards
Hector

Whenever you think you can or you can't, in either way you are right.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to