mabshoff wrote:
ed smaller values.  I'm going to
>>> put that data up on the trac ticket.
>> Mathematica 6 (on a Sun SPARC) gives an answer in far less time than Sage:
>>
>> In[3]:= PrimePi[2^50]
>>
>> PrimePi::largp:
>>     Argument 1125899906842624 in PrimePi[1125899906842624]
>>       is too large for this implementation.
>>
>> Out[3]= PrimePi[1125899906842624]
>>
>> Well, perhaps not really an answer!
> 
> :)
> 
> Could you figure out what the upper bound is that MMA allows? I have
> discussed this with William in IRC and in 3.4.2 we should just throw a
> NotImplementedError for some bound where we are comfortable with
> knowing the result is correct on 32 and 64 bit. Unfortunately this
> isn't something we can doctest with a reasonable amount of time.
> 
> The suggestion then was to implement something on top of the range
> computed with floats using MPFR for example, but we will see what
> happens. I am sure that if I asked if someone needed to compute
> prime_pi() for anything larger than 2^48 someone would say yes, so
> this ought to be fixed.
> 
> Cheers,
> 
> Michael

Hi Micheal,

Yes, I can figure it out.

The upper limit is PrimePi[249999999999999] (2.5x10^14), which 
Mathematica gives as 7783516108362. It took 20 minutes or so on a 
heavily loaded machine.

In[95]:= PrimePi[249999999999999]

Out[95]= 7783516108362

It can not manage PrimePi[250000000000000]

2^47 is 1.41x10^14,
2^48 is 2.81x10^14.

Since the maximum that can be handled is just under 2.5x10^14, 
Mathematica can compute PrimePi[2^47], but not PrimePi[2^48]

Here's a table of PrimePi[2^n], with n ranging from 0 to 47. It took 
roughly 20 minutes or so to compute the table.

In[19]:= Table[{n,PrimePi[2^n]},{n,0,47}]

Out[19]= {{0, 0}, {1, 1}, {2, 2}, {3, 4}, {4, 6}, {5, 11}, {6, 18}, {7, 31},

 >    {8, 54}, {9, 97}, {10, 172}, {11, 309}, {12, 564}, {13, 1028},

 >    {14, 1900}, {15, 3512}, {16, 6542}, {17, 12251}, {18, 23000},

 >    {19, 43390}, {20, 82025}, {21, 155611}, {22, 295947}, {23, 564163},

 >    {24, 1077871}, {25, 2063689}, {26, 3957809}, {27, 7603553},

 >    {28, 14630843}, {29, 28192750}, {30, 54400028}, {31, 105097565},

 >    {32, 203280221}, {33, 393615806}, {34, 762939111}, {35, 1480206279},

 >    {36, 2874398515}, {37, 5586502348}, {38, 10866266172},

 >    {39, 21151907950}, {40, 41203088796}, {41, 80316571436},

 >    {42, 156661034233}, {43, 305761713237}, {44, 597116381732},

 >    {45, 1166746786182}, {46, 2280998753949}, {47, 4461632979717}}


PS, Mathematica computes PrimePi[some_negative_number] as 0. Does Sage 
handle that case ok?

Dave






--~--~---------~--~----~------------~-------~--~----~
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