Alex Ghitza wrote:
> On Fri, May 1, 2009 at 5:13 PM, mabshoff <mabsh...@googlemail.com> wrote:
>> While going over the open tickets in 4.0 I noticed this ticket:
>>
>>   #5943 (Sage 3.4.2.a0: prime_pi(2^50) segfaults)
>>
>> If someone could take a stab at that it would be nice since that is
>> brand new code and ought to be a little bit more stable than that. I
>> am waiting on a fix for #5952 in the morning, i.e. Saturday, so some
>> hero might want to earn some brownie points over night :)
>>
> 
> Brownies are overrated.
> 
> I played around with prime_pi() for a while, both on sage.math and on
> my laptop at the office (macbook running 32-bit archlinux).  I didn't
> manage to get a segfault on either machine with prime_pi(2^50).  I
> guess that's the good news?  Anyway, the bad news is that the answers
> returned do not agree between the two machines, e.g.
> 
> {{{
> # on sage.math
> sage: time prime_pi(2^50)
> CPU times: user 4854.46 s, sys: 3.17 s, total: 4857.63 s
> Wall time: 4857.73 s
> 33483379603407
> #
> # on my laptop
> sage: time prime_pi(2^50)
> CPU times: user 5555.60 s, sys: 7.81 s, total: 5563.40 s
> Wall time: 5598.64 s
> 21969300962685
> }}}
> 
> I'm pretty sure that the sage.math answer is more likely to be the
> right one.  You can maybe guess from the timings why I didn't try
> prime_pi(2^51).  I have, however, tried smaller values.  I'm going to
> put that data up on the trac ticket.


You should have used Mathematica - it returns its answer very quickly:


Mathematica 6.0 for Sun Solaris SPARC (64-bit)
Copyright 1988-2008 Wolfram Research, Inc.

In[1]:= ?PrimePi
PrimePi[x] gives the number of primes \[Pi] (x) less than or equal to x.

In[2]:= PrimePi[2^50]

PrimePi::largp:
    Argument 1125899906842624 in PrimePi[1125899906842624]
      is too large for this implementation.

Out[2]= PrimePi[1125899906842624]


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

Reply via email to