#5130: [with patch; not ready for review] create a prime_pi function that 
doesn't
just compute len(prime_range(n))
---------------------------+------------------------------------------------
 Reporter:  was            |        Owner:  was     
     Type:  defect         |       Status:  new     
 Priority:  major          |    Milestone:  sage-3.3
Component:  number theory  |   Resolution:          
 Keywords:                 |  
---------------------------+------------------------------------------------
Old description:

> The goal of this ticket is to make something eventually competitive with
> Mathematica's PrimePi.  The first version won't do that, but it is a step
> in the right direction.
>
> Note that evidently the only program we know of with a fast prime_pi is
> Mathematica (pari, maple, etc., -- none of them have anything at all).
> In contract, Mathematica can do {{{PrimePi[10^14]}}} in "about a minute",
> but the algorithm there doesn't allow larger input.
>
> {{{
> In[11]:= Timing[PrimePi[ 10^13 + 10^8 +10^9]]
> Out[11]= {12., 346102281239}
>
> In[13]:= Timing[PrimePi[10^14]]
> Out[13]= {59.53, 3204941750802}
> }}}
>
> The attached code did {{{10^14}}} in just under an hour.   The issue is
> that Mathematica implements a different sublinear algorithm.
>
> In Sage, with extra storage usage:
> {{{
> sage: k = 10^13
> sage: time print prime_pi(k,40)
> 346065536839
> Time: CPU 219.44 s, Wall: 219.44 s
> }}}
>
> So for that one mathematica is 18 times faster.

New description:

 The goal of this ticket is to make something eventually competitive with
 Mathematica's PrimePi.  The first version won't do that, but it is a step
 in the right direction.

 Note that evidently the only program we know of with a fast prime_pi is
 Mathematica (pari, maple, etc., -- none of them have anything at all).  In
 contract, Mathematica can do {{{PrimePi[10^14]}}} in "about a minute", but
 the algorithm there doesn't allow larger input.

 {{{
 In[11]:= Timing[PrimePi[ 10^13 + 10^8 +10^9]]
 Out[11]= {12., 346102281239}

 In[13]:= Timing[PrimePi[10^14]]
 Out[13]= {59.53, 3204941750802}
 }}}

 The attached code did {{{10^14}}} in just under an hour.   The issue is
 that Mathematica implements a different sublinear algorithm.

 In Sage, with extra storage usage:
 {{{
 sage: k = 10^13
 sage: time print prime_pi(k,40)
 346065536839
 Time: CPU 219.44 s, Wall: 219.44 s
 }}}

 So for that one mathematica is 18 times faster.

 Another comparison for smaller input, where this is better:
 {{{
 sage: time prime_pi(10^10,32)
 CPU times: user 0.59 s, sys: 0.04 s, total: 0.63 s
 Wall time: 0.63 s
 455052511L

 ...

 wst...@sage:~$ math
 Mathematica 6.0 for Linux x86 (64-bit)
 Copyright 1988-2007 Wolfram Research, Inc.
 In[1]:= Timing[PrimePi[10^10]]
 Out[1]= {0.12, 455052511}
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5130#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to