On Nov 2, 2009, at 3:22 PM, davedo2 wrote:

>
> OK, I downloaded Sage 4.2 and -testall seemed OK. However, I have a
> question: if I evaluate pari(7).isprime() in the notebook it returns
> True, but if I try it from the Sage command line it spawns a longish
> list of errors - what's up with that?
>
> Also, is there a way to invoke it such that it returns 1 or 0 instead
> of True or False? Thanks...Dave

How about

sage: int(pari(7).isprime())
1

Though I don't know what the advantage to return 1 or 0 would be. Note  
that

sage: sum(is_prime(n) for n in range(100))
25

works just fine.

BTW, you don't have to invoke pari explicitly here, it's faster to do

sage: is_prime(7)
True
sage: int(is_prime(7))
1

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to