On Tue, Apr 5, 2016 at 9:56 AM, Nils Bruin <nbr...@sfu.ca> wrote:
> Hi everyone,
>>
>> I was just doing a routine check for a Chaum-van Antwerpen Signature
>> Scheme public parameter set(p=2q+1, p,q both odd primes) and in checking a
>> small prime, it told me that it was composite. I'm not sure if it's just my
>> build, but obviously I can't have this happening without understanding why.
>> Any clues as to what could be wrong in my setup?
>>
>> thanks
>
>
> No, this is confusing, but it behaves as documented. The problem is:

It is my fault I think, but it is terrible.  A month ago (when there
was that Diffie-Hellman prime-that-isnt-prime that Oracle planted), we
had at least two people hitting this exact problem.  And this is just
what we explicitly heard about from people that mailed the list.

I even hit this exact problem when preparing my lecture for a course
yesterday.

I think we should change is_prime for rational numbers, since people
get confused by this so much.

How?  Pretty much any change at all would be better than the current
situation.  Options I can think of:

- make is_prime([rational]) raise an error and tell the user what to do
- look at what is_prime([rational]) does in Pari, Mathematica, etc.,
and do the same thing
- make is_prime([rational]) return is_prime(ZZ([rational]))    -- this
would be a change that would potentially silently break some code, but
is what many people expect.

William

>
> sage: parent(q)
> Rational Field
>
> so q is a rational number. In the rational numbers, non-zero elements are
> units and hence not prime.
>
> Division of integers yields a rational number. If you want to get an integer
> out, use // instead:
>
> sage: q=(p-1)//2
> sage: q.is_prime()
> True
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to